Computer Science EngineeringHard
A circular queue is stored in an array of size 8 and uses the convention (rear+1) mod 8 == front for 'full'. Maximum number of elements it can hold is
- A. 7
- B. 8
- C. 6
- D. 9
Correct answer: A. 7
One cell is sacrificed to distinguish full from empty, leaving 7.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- For the pattern ABABACA, the KMP longest-proper-prefix-which-is-also-suffix value at the last position is
- Radix sort of n numbers with d digits in base b using a stable counting sort per digit takes
- What does g(48, 18) return for int g(int a,int b){ return b==0 ? a : g(b, a%b); }
- What does this fragment print? int a[]={3,1,4,1,5}; int s=0; for(int i=0;i<5;i++) s ^= a[i]; printf("%d", s);
- A binary tree with n nodes stored with left and right pointers has how many NULL pointers in total?
- How many times does c++ execute in: int c=0; for(int i=1;i<=100;i=3) c++;