SPIA 121-140
42 Questions
8 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Na kojem principu radi bubble sort?

Najgori slučaj kod bubble sorta je

  • naopako sortiran niz
  • već sortiran niz
  • niz sa približno istim vrijednostima članova
  • niz sa dosta članova sa istom vrijednosti

Insertion sort radi tako da se uzme ______ član nesortiranog dijela niza i postavi _________________ u sortiranom dijelu niza.

Bubble sort ima manju apriornu složenost od insertion sorta.

<p>False (B)</p> Signup and view all the answers

Položaj elemenata niza je bitan za učinkovitost insertion sorta

<p>True (A)</p> Signup and view all the answers

Za koji algoritam sortiranja se koristi pojam k – sortiranog niza (k je korak)?

<p>shell (D)</p> Signup and view all the answers

Insertion sort je bolji od bubble sorta na nizu do 100.000 elemenata

<p>False (B)</p> Signup and view all the answers

Od sortova složenosti O(n^2) na nizu do 100.000 elemenata najbolji od ponuđenih je

<p>shell (B)</p> Signup and view all the answers

Merge i quick sort koriste princip

Signup and view all the answers

Složenost merge sorta je O(nlog2n).

<p>False (B)</p> Signup and view all the answers

Najbolji slučaj merge sorta je već sortiran niz

<p>False (B)</p> Signup and view all the answers

Koji je do sada najbrži poznati algoritam sortiranja?

Signup and view all the answers

Izbor pivota kod quick sorta nije jednoznačan.

<p>False (B)</p> Signup and view all the answers

Merge sort je zbog složenosti O(nlogn) brži za izvođenje od quick sorta.

<p>False (B)</p> Signup and view all the answers

Šta je indirektno sortiranje?

Signup and view all the answers

Šta je stog?

Signup and view all the answers

Stog koristi FIFO princip

<p>False (B)</p> Signup and view all the answers

Kako se rješava problem punog stoga?

Signup and view all the answers

Linearna lista realizirana kao dinamička struktura podataka sadrži

<p>pokazivač na prvi član liste i proizvoljan broj atoma (A)</p> Signup and view all the answers

Svaki atom linearne liste sadrži polja sa

<p>vrijednosti člana liste i pokazivača na sljedeći član</p> Signup and view all the answers

Dinamička linearna lista znači da

<p>se lista zauzima i oslobađa memoriju po potrebi (C)</p> Signup and view all the answers

Na kojem principu radi bubble sort?

Signup and view all the answers

Najgori slučaj kod bubble sorta je

Signup and view all the answers

Insertion sort radi tako da se uzme ______ član nesortiranog dijela niza i postavi _________________ u sortiranom dijelu niza.

Signup and view all the answers

Bubble sort ima manju apriornu složenost od insertion sorta.

<p>True (A)</p> Signup and view all the answers

Položaj elemenata niza je bitan za učinkovitost insertion sorta

<p>True (A)</p> Signup and view all the answers

Za koji algoritam sortiranja se koristi pojam k – sortiranog niza (k je korak)?

<p>shell (D)</p> Signup and view all the answers

Insertion sort je bolji od bubble sorta na nizu do 100.000 elemenata

<p>True (A)</p> Signup and view all the answers

Od sortova složenosti O(n^2) na nizu do 100.000 elemenata najbolji od ponuđenih je

<p>shell (B)</p> Signup and view all the answers

Merge i quick sort koriste princip

Signup and view all the answers

Složenost merge sorta je O(nlog2n).

<p>True (A)</p> Signup and view all the answers

Najbolji slučaj merge sorta je već sortiran niz

<p>True (A)</p> Signup and view all the answers

Koji je do sada najbrži poznati algoritam sortiranja?

Signup and view all the answers

Izbor pivota kod quick sorta nije jednoznačan.

<p>True (A)</p> Signup and view all the answers

Merge sort je zbog složenosti O(nlogn) brži za izvođenje od quick sorta.

<p>True (A)</p> Signup and view all the answers

Šta je indirektno sortiranje?

Signup and view all the answers

Šta je stog?

Signup and view all the answers

Stog koristi FIFO princip

<p>True (A)</p> Signup and view all the answers

Kako se rješava problem punog stoga?

Signup and view all the answers

Linearna lista realizirana kao dinamička struktura podataka sadrži

<p>pokazivač na prvi član liste i proizvoljan broj atoma (A)</p> Signup and view all the answers

Svaki atom linearne liste sadrži polja sa

<p>vrijednosti člana liste i pokazivača na sljedeći član</p> Signup and view all the answers

Dinamička linearna lista znači da

<p>se lista zauzima i oslobađa memoriju po potrebi (C)</p> Signup and view all the answers

Study Notes

Sorting Algorithms

  • Bubble sort operates on the principle of iterating through an array, comparing adjacent elements and swapping them if they are in the wrong order.
  • The worst-case scenario for bubble sort is when the array is reverse sorted.
  • Insertion sort works by taking an element from the unsorted part of the array and placing it in the correct position in the sorted part of the array.
  • Bubble sort has a lower apriori complexity than insertion sort.
  • The position of elements in the array is crucial for the efficiency of insertion sort.
  • For arrays up to 100,000 elements, insertion sort is better than bubble sort.
  • Among O(n^2) complexity sorts for arrays up to 100,000 elements, the best is insertion sort.

Merge and Quick Sort

  • Merge sort and quick sort use the divide and conquer principle.
  • The complexity of merge sort is O(nlog2n).
  • The best-case scenario for merge sort is when the array is already sorted.
  • Quick sort's pivot selection is not unique.
  • Merge sort is faster than quick sort due to its O(nlogn) complexity.

Stacks and Dynamic Data Structures

  • Indirect sorting refers to sorting data that is not physically moved, but rather referenced through pointers.
  • A stack uses the FIFO (First-In-First-Out) principle.
  • A problem with a full stack is solved by allocating more memory or deallocating unused memory.
  • A linear list implemented as a dynamic data structure contains a sequence of nodes.
  • Each node in a linear list contains fields with a value and a reference to the next node.
  • Dynamic linear list means that nodes can be dynamically allocated and deallocated as needed.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Description

Test your knowledge of sorting algorithms with this quiz! Explore concepts like the performance of insertion sort, bubble sort, and merge sort on arrays of up to 100,000 elements, as well as the usage of k-sorted arrays. Additionally, identify the best-case scenario for merge sort.

More Like This

Use Quizgecko on...
Browser
Browser