We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 3
the elements in sequence by using the loop counter as the array subscript.
6) In what areas do data structures are applied?
Data structures are essential in almost every aspect where data is involved. In general,
algorithms that involve efficient data structure is applied in the following areas: numerical
analysis, operating system, A.1., compiler design, database management, graphics, and
statistical analysis, to name a few.
7) What is LIFO?
LIFO is a short form of Last In First Out. It refers how data is accessed, stored and retrieved.
Using this scheme, data that was stored last should be the one to be extracted first. This also
means that in order to gain access to the first data, all the other data that was stored before this
first data must first be retrieved and extracted.
8) What is a queue?
A queue is a data structure that can simulate a list or stream of data. In this structure, new
elements are inserted at one end, and existing elements are removed from the other end.
9) What are binary trees?
A binary tree is one type of data structure that has two nodes, a left node, and a right node. In
programming, binary trees are an extension of the linked list structures.
10) Which data structures are applied when dealing with a recursive function?
Recursion, is a function that calls itself based on a terminating condition, makes use of the
stack. Using LIFO, a call to a recursive function saves the return address so that it knows how
to return to the calling function after the call terminates.
11) What is a stack?
A stack is a data structure in which only the top element can be accessed. As data is stored in
the stack, each data is pushed downward, leaving the most recently added data on top.
12) Explain Binary Search Tree
Abinary search tree stores data in such a way that they can be retrieved very efficiently. The
left subtree contains nodes whose keys are less than the node's key value, while the right
subtree contains nodes whose keys are greater than or equal to the node's key value.
Moreover, both subtrees are also binary search trees.
13) What are multidimensional arrays?data being added to it, meaning data is being “pushed” into the stack. On the other hand, a pop
denotes data retrieval, and in particular, refers to the topmost data being accessed
22) What is a linear search?
A linear search refers to the way a target key is being searched in a sequential data structure. In
this method, each element in the list is checked and compared against the target key. The
process is repeated until found or if the end of the file has been reached.
23) How does variable declaration affect memory allocation?
The amount of memory to be allocated or reserved would depend on the data type of the
variable being declared. For example, if a variable is declared to be of integer type, then 32 bits
of memory storage will be reserved for that variable.
24) What is the advantage of the heap over a stack?
The heap is more flexible than the stack. That's because memory space for the heap can be
dynamically allocated and de-allocated as needed. However, the memory of the heap can at
times be slower when compared to that stack.
25) What is a postfix expression?
A postfix expression is an expression in which each operator follows its operands. The
advantage of this form is that there is no need to group sub-expressions in parentheses or to
consider operator precedence.
26) What is Data abstraction?
Data abstraction is a powerful tool for breaking down complex data problems into manageable
chunks. This is applied by initially specifying the data objects involved and the operations to be
performed on these data objects without being overly concerned with how the data objects will
be represented and stored in memory.
27) How do you insert a new item in a binary search tree?
Assuming that the data to be inserted is a unique value (that is, not an existing entry in the tree),
check first if the tree is empty. If it's empty, just insert the new item in the root node. If it's not
empty, refer to the new item's key. If it's smaller than the root's key, insert it into the root's left
subtree, otherwise, insert it into the root's right subtree.
28) How does a selection sort work for an array?
The selection sort is a fairly intuitive sorting algorithm, though not necessarily efficient. In this
process, the smallest element is first located and switched with the element at subscript zero,
thereby placing the smallest element in the first position.merge sort, etc. Not one can be considered the fastest because each algorithm is designed for
a particular data structure and data set. It would depend on the data set that you would want to
sort,
37) Differentiate STACK from ARRAY.
‘Stack follows a LIFO pattern. It means that data access follows a sequence wherein the last
data to be stored when the first one to be extracted. Arrays, on the other hand, does not follow a
particular order and instead can be accessed by referring to the indexed element within the
array.
38) Give a basic algorithm for searching a binary search tree.
1. if the tree is empty, then the target is not in the tree, end search
2. if the tree is not empty, the target is in the tree
3, check if the target is in the root item
4. if a target is not in the root item, check if a target is smaller than the root's value
5. if a target is smaller than the root's value, search the left subtree
6. else, search the right subtree
39) What is a dequeue?
A dequeue is a double-ended queue. This is a structure wherein elements can be inserted or
removed from either end.
40) What is a bubble sort and how do you perform it?
A bubble sort is one sorting technique that can be applied to data structures such as an array. It
works by comparing adjacent elements and exchanges their values if they are out of order. This
method lets the smaller values “bubble” to the top of the list, while the larger value sinks to the
bottom.
41) What are the parts of a linked list?
A linked list typically has two parts: the head and the tail. Between the head and tail lie the
actual nodes. All these nodes are linked sequentially.
42) How does selection sort work?
Selection sort works by picking the smallest number from the list and placing it at the front. This
process is repeated for the second position towards the end of the list. It is the simplest sort
algorithm.
43) What is a graph?
A graph is one type of data structure that contains a set of ordered pairs. These ordered pairs