Please write about the relationship between data structures and algorithms.
A data structure is a way of storing data in a computer so that it can be used efficiently, often allowing for the most efficient algorithm to be used. A well-designed data structure allows a variety of critical operations to be performed, using as few resources, both execution time and memory space, as possible.
What is the difference between a stack and a queue?
A stack lets you insert and remove elements from the top of the stack using what is referred to as Last In First Out (LIFO) order while a queue lets you insert data at one end and remove it from the other end using what is referred to as First In First Out (FIFO) order.
Pick two sorting algorithms and explain how they work.
Insertion sort - a simple sorting algorithm that sorts an array/or list via comparison. It is less efficient on large lists.Selection Sort - a sorting algorithm, specifically an in-place comparison sort. It is inefficient on larger lists, and performs worse than the insertion sort.
No comments:
Post a Comment