Monday, March 6, 2023

Primitive&Non-primitive-Data-types

    Data structures are the building blocks of algorithms and computer programs, the primitive -- or base -- data types are the building blocks of data structures. The typical base data types include the following:

·         Boolean, Its store's logical values that are either true or false.


·         integer, which stores an ambition on mathematical integers -- or counting numbers. Different-sized integers hold different ambitions of values -- e.g., a signed 8-bit integer holds values from -128 to 127, and an unsigned long 32-bit integer holds values from 0 to 4,294,967,295.

·         Floating-point numbers, it is store a formulaic representation of real numbers.

·         Fixed-point numbers, which are used in some programming languages and hold real values but are executed as digits to the left and the right of the decimal point.

·         Character, it is uses symbols from a defined mapping of integer values to symbols.

·         Pointers, there are reference values that point to other values.

·         String, it is an array of characters followed by a stop code -- usually a "0" value -- or is execute using a length field that is an integer value.

The data structure hierarchy shows how data types and data structures are related.

Types of data structures

The data structure type used in a particular situation is constant by the type of operations that will be required or the kinds of algorithms that will be applied. The changeable data structure types include the following:



·         Array array stores a collection of items at adjoining memory locations. Items there are the same type are stored stably so the position of each element can be calculated or restored easily by an index. Arrays can be established or flexible in length.

An array can hold a collection of integers, floating-point numbers, wounds or even other arrays.

·         Stack.  Stack is a linear data structure. the stack stores an acquiring of items in the linear order that operations are applied. The order  may be LIFO(last in first out)

·         Queue queue from the Latin word means a line of people or vehicles waiting their turn.it stores a collection of items like a stack; however, the operation order can only be first in, first out.

·         Linked list. A linked list stores a collection of items in a linear order. Each element, or node, in a linked list contains data things, as well as a reference, or link, to the next item in the list

·         Tree. A tree stores an acquiring of things in a complex, hierarchical way. And other node is associated with a key value, with parent nodes linked to child nodes -- or subnodes. They  have one root node that is the ancestor of all the nodes in the tree.

Heap.    A heap is a tree-based structure in which each parent node's associated key value is greater than or equal to the key values of any of its children's key values.

·         Graph. A graph stores a collection of things in a nonlinear fashion. And the Graphs are made up of a finite set of nodes, also called vertices, and lines that connect them, also known as edges. They have useful for representing real-world systems such as computer networks.

·         Trie. A trie, also known as a keyword tree, is a data structure that stores strings as data things that can be organized in a visible graph.

·         Hash table. A hash table -- also known as a hash map -- stores an acquiring of things  in an associative array that plots keys to values. A hash table uses a hash function. It converts an index into an array of buckets that contain the desired data item.

These are considered complex data structures as they can store large amounts of interconnected data.

How to choose a data structure

Some  examples include:

·         Linked lists are best if a program is managing a collection of items that don't need to be ordered, constant time is required for adding or removing an item from the acquiring and increased search time is OK.

·         Stacks are best if the program is managing an acquisition that needs to support a LIFO order.

·         Queues should be used if the program is managing an acquisition that needs to support a FIFO order.

·         Binary trees are good for managing the acquiring of items with a parent-child relationship, such as a family tree.

·         Binary search trees are applicable for managing a sorted acquiring where the goal is to optimize the time it takes to find specific items in the acquiring.

·         Graphs work best if the application will analyze connectivity and relationships mid-acquiring of exclusives in a social media network.

This was last updated in March 2021

 

Data -structures- definition- importants-uses-Characteristics

  

·    A data structure is a specialized format for organizing, retrieving, processing, and storing data. There are different basic and advanced types of data structures, all designed to arrange data to suit a specific specialized purpose. Data structures make it easy for users to approach and work with the data they need in opportune ways. Most importantly, data structures frame the composition of information so that machines and humans can better understand it.

In computer science and computer programming, a data structure may be selected or designed to store data for the purpose of using it with various changeable algorithms. In some cases, the algorithm's basic operations are deeply coupled to the data structure's design. Each data structure involves information about the data values, relationships between the data, and -- in some cases -- functions that can be applied to the data. For instance, in an object-oriented programming language, the data structure and its associated methods are bound together as part of a class definition. In non-object-oriented languages, there may be functions concerned to work with the data structure, but they are not technically part of the data structure.



Why are data structures important?

Typical base data types, such as integers or floating-point values, that are available in most computer programming languages are commonly insufficient to capture the logical intent for data processing and use. Yet applications that ingest, manipulate and consequence information must understand how data should be organized to analyze processing. Data structures conduct together the data elements in a logical way and facilitate the effective use, unity, and sharing of data. They provide a formal model that describes the way the data elements are organized.

How are data structures used?

In general, data structures are used to appliance the physical forms of abstract data types. Data structures are a necessary part of designing efficient software. They also play a critical role in algorithm design and how those algorithms are used in clear computer programs.

Some examples of how data structures are used include the following:

·         Storing data. Data structures are used for efficient data persistence, such as specifying the collection of aspects and corresponding structures used to store records in a database management system.

·         Managing resources and services. Core operating system (OS) resources and services are approved through the use of data structures such as linked lists for memory allocation, file directory management, and file structure trees, as well as process appointment queues.

·         Data exchange. Data structures define the conformation of information shared between applications, such as TCP/IP packets.

·         Ordering and sorting. Data structures such as binary search trees -- also known as ordered or sorted binary trees -- provide active methods of sorting objects, such as character strings used as tags. With data structures such as arrangement queues, programmers can manage items organized according to a specific priority.

Indexing.

·         alike more sophisticated data structures will be B-trees are used to basis objects, which will be those stored in a database.

·         Searching. Indexes created using binary search trees, B-trees, or hash tables speed the capability to asset a unique sought-after item.

·         Scalability. Big data applications use data structures for allowance and executive data storage beyond distributed storage locations, ensuring scalability and performance.  assertive big data programming environments -- such as apache spark -- provide data structures that mirror the underlying structure of database records to analyze querying.

Characteristics of data structures

 The following three characteristics are examples of data structure.

1.    Linear or non-linear. This characteristic defines whether the data items are disposed in sequential order, such as with an array, or in an unordered sequence,  will be with a graph.

2.    Homogeneous or heterogeneous. This characteristic defines whether all data items in a given repository are of the same type. One example is the acquisition of elements in an array, or of changeable types,  will be an abstract data type defined as a structure in C or java and in the class specification.

Static or dynamic. 
This characteristic defines how the data structures are compiled.  they have fixed sizes, structures, and memory locations at compile time. Dynamic data structures have sizes, structures, and memory locations that can shrink or expand, depending on the use