Here are Questions for Data Structures as i found it..
1- A recursive function must have two parts: its basis and its recursive part.
2- 1AVL tree: Every balance number is either –1, 0 or 1
3- The insertion sort runs in O(n^2) time.
4- The merge sort runs in O(n lg n) time
5- The recursive binary search runs in O(lg n) time
6- Stack contains 4 elements after 3 peek() operations and
3 push() operations, its size becomes :
أنا اخترت 7
7- Queue Q=[10,20,30,40], Stack S[], , after implementation
this code
Int x;
Int n= Q.length;
For (int i=0, i<n, i++)
{
X=Q.dequeue();
S.push(x);
Q.enqueue();
}
اجابتي:
Q=[10,20,30,40]
S=[40,30,20,10]
8- if there is 20 elements the the number of comparison
in binary search
اجابتي:
Always less or equal to 5 ??
-------
9- insertion a node in linked list
وخياراته كانت
In the front
Bottom
Middle
Anywhere
في اللينكد الانسرت يكون بين اندكسين يعني لو بدرج نود الاندكس حقها 5 بيكون بين 6 و 4
طبعا اتحكم بيها عن طريق الكود
وممكن كمان لو ابغى ادرج في مقدمة النود
بعكس الqueue وstack
فعشان كدا اخترت
anywhere
صح؟
10- في سؤال كمان مافهمته مرة تقريبا صيغته كانت:
Given binary search , to get sequence of elements we use
انا اخترت
preorder traversal algorithm
السؤال مو واضح مرة لانه كل اللوغريتمات تعطي سكونس اليمنت .. بس ماحدد الترتيب المطلوب