2024-03-26T18:51:37+03:00[Europe/Moscow] en true <p>Time complexity of quickSort</p>, <p>Time complexity of mergeSort</p>, <p>What is the maximum height difference between branches in an AVL tree?</p>, <p>Operation for reading from a linked list</p>, <p>Arrays are fast for ______ but slow for _________, while linked lists are the opposite</p>, <p>Dynamic arrays are called ________ in java</p>, <p>Bags (sets) notes</p>, <p>Operations for queues</p>, <p>Worst and best case space complexity for tries</p>, <p>Note</p>, <p>Knuth Morris search algorithm steps</p>, <p>Time complexity for Dijstra's algorithm</p>, <p>Is insertion sort faster than selection sort?</p>, <p>Time complexity knuth-Morris</p>, <p>Time complexirt boyer-Moore</p> flashcards
DSA

DSA

  • Time complexity of quickSort

    Worst case: n^2, best case: n log n

  • Time complexity of mergeSort

    n log n, worst, average and best

  • What is the maximum height difference between branches in an AVL tree?

    1

  • Operation for reading from a linked list

    O(n)

  • Arrays are fast for ______ but slow for _________, while linked lists are the opposite

    access, addition/deletion

  • Dynamic arrays are called ________ in java

    ArrayLists

  • Bags (sets) notes

  • Operations for queues

    enqueue(), dequeue(), isEmpty(), size()

  • Worst and best case space complexity for tries

    worst: O(K x L), where K is the number of words or keys and L is the average length of each of them. best: O(K + L)

  • Note

    When discussing space complexity, we are mainly concerned with the additional space used by the algorithm beyond the space needed to store the input itself.

  • Knuth Morris search algorithm steps

    Build failure function. (essentially P[j] is every node in the input string and f(j) is 0 or however many times the same value as occurred consecutively immediately before in the big string (so P[j-1] = P[j])). Then start comparing at the start of both strings. If a mismatch and no characters to the left in the input string, shift one space to the right. If a mismatch and there is characters to the left, consult the failure function corresponding to the value immediately on the left and move the string n-f spaces, where n is the number of spaces to get to the beginning of the string, and f is the value of the failure function. If a match, keep comparing without shifting the input string.

  • Time complexity for Dijstra's algorithm

    O(ElogV)

  • Is insertion sort faster than selection sort?

    Yes

  • Time complexity knuth-Morris

    O(n+m)

  • Time complexirt boyer-Moore

    O(nm)