Chapter 1 Data Structures

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Graph

A graph is a data structure for representing connections among items, and consists of vertices connected by edges. A vertex represents an item in a graph. An edge represents a connection between two vertices in a graph.

Hash table

A hash table is a data structure that stores unordered items by mapping (or hashing) each item to a location in an array.

linked lists

A linked list is a data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.

Abstract data types (ADTs)

An abstract data type (ADT) is a data type described by predefined user operations, such as "insert data at rear," without indicating how each operation is implemented. An ADT can be implemented using different underlying data structures. However, a programmer need not have knowledge of the underlying implementation to use an ADT. Ex: A list is a common ADT for holding ordered data, having operations like append a data item, remove a data item, search whether a data item exists, and print the list. A list ADT is commonly implemented using arrays or linked list data structures.

Algorithms

An algorithm describes a sequence of steps to solve a computational problem or perform a calculation. An algorithm can be described in English, pseudocode, a programming language, hardware, etc. A computational problem specifies an input, a question about the input that can be answered using a computer, and the desired output.

Algorithm efficiency

An algorithm describes the method to solve a computational problem. Programmers and computer scientists should use or write efficient algorithms. Algorithm efficiency is typically measured by the algorithm's computational complexity. Computational complexity is the amount of resources used by the algorithm. The most common resources considered are the runtime and memory usage.

Runtime complexity

An algorithm's runtime complexity is a function, T(N), that represents the number of constant time operations performed by the algorithm on an input of size N. Runtime complexity is discussed in more detail elsewhere. Because an algorithm's runtime may vary significantly based on the input data, a common approach is to identify best and worst case scenarios. An algorithm's best case is the scenario where the algorithm does the minimum possible number of operations. An algorithm's worst case is the scenario where the algorithm does the maximum possible number of operations.

Array

An array is a data structure that stores an ordered list of items, where each item is directly accessible by a positional index.

Binary tree

A binary tree is a data structure in which each node stores data and has up to two children, known as a left child and a right child.

Data Structure

A data structure is a way of organizing, storing, and performing operations on data. Operations performed on a data structure include accessing or updating stored data, searching for specific data, inserting new data, and removing data. The following provides a list of basic data structures.

Heap

A max-heap is a tree that maintains the simple property that a node's key is greater than or equal to the node's childrens' keys. A min-heap is a tree that maintains the simple property that a node's key is less than or equal to the node's childrens' keys.

Record

A record is the data structure that stores subitems, often called fields, with a name associated with each subitem.

Space complexity

An algorithm's space complexity is a function, S(N), that represents the number of fixed-size memory units used by the algorithm for an input of size N. Ex: The space complexity of an algorithm that duplicates a list of numbers is S(N) = 2N + k, where k is a constant representing memory used for things like the loop counter and list pointers. Space complexity includes the input data and additional memory allocated by the algorithm. An algorithm's auxiliary space complexity is the space complexity not including the input data. Ex: An algorithm to find the maximum number in a list will have a space complexity of S(N) = N + k, but an auxiliary space complexity of S(N) = k, where k is a constant.

NP-complete (Algorithms)

NP-complete problems are a set of problems for which no known efficient algorithm exists. NP-complete problems have the following characteristics: No efficient algorithm has been found to solve an NP-complete problem. No one has proven that an efficient algorithm to solve an NP-complete problem is impossible. If an efficient algorithm exists for one NP-complete problem, then all NP-complete problem can be solved efficiently. By knowing a problem is NP-complete, instead of trying to find an efficient algorithm to solve the problem, a programmer can focus on finding an algorithm to efficiently find a good, but non-optimal, solution.


Set pelajaran terkait

Chapter 55: Care of the Patient with an Immune Disorder

View Set

the scientific revolution and the enlightenment

View Set

psych chapter3 : Developing Through the Life Span

View Set

Power and Influence Tactics (ch 6)

View Set

Health and Wellness & Leading Causes of Death

View Set