Hndit 1
Hndit 1
1.
a. W hat is anAbstract Data Type (ADT)? How does it differfrom a data
structure?
b. Write a Java method or pseudocode to determine whether a given integer
is a prime number.. (Hint: A prime number is greater than 1 and divisible
only by 1 and itself.)
c. What isBig O Notation, and why is it important inanalysis of algorithm?
d. Define an array data structure and explain the Big O time complexities for
search, insert, add, and delete operations.
2.
a. C ompareArrayListandLinkedListin terms of theirstructure,
performance,e.
b. Explain thePush,Pop, andPeekoperations in aStack
c. Explain theFrontandRearpointers in aQueue, andillustrate the add
and remove
d. Diagramatically Show the insertion of following dataset in binary search
tree
50, 30, 70, 20, 40, 60, 80, 10, 25, 65.
3.
a. W hat is search algorithm? Briefly explain two types of searching
algorithm?
b. Write a java code for linear search?
c. Selection sort is better than bubble sort, do you agree? Justify your
answer
d. List down the time complexity for considering the worst case scenario
Operation Array Arraylist Linkedlist Stack Queue inary
B inear
L inary
B Insertio election
S ubble
B
Search Search Search n Sort Sort Sort
Tree
earch/S
S
ort
Insert
Delete