{"id":274,"date":"2017-06-13T14:46:00","date_gmt":"2017-06-13T12:46:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/2017\/06\/13\/introduction-to-data-structures\/"},"modified":"2020-08-22T20:43:11","modified_gmt":"2020-08-22T18:43:11","slug":"introduction-to-data-structures","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/introduction-to-data-structures\/","title":{"rendered":"Introduction to Data Structures"},"content":{"rendered":"<div><span style=\"font-family: 'trebuchet ms' , sans-serif;\">The concept of Data Structures is a very important concept in modern computer science. So, in this course we would examine what data structure is all about and then we briefly look at different data structures being used today.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif;\">Data and Data Structure<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif;\">Data can be\u00a0 defined in a number of ways but it would suffice to say that data is\u00a0 a unit of information.\u00a0<\/span><br \/>\n<span style=\"font-family: 'trebuchet ms' , sans-serif;\">An example would be biodata which would include:<\/span><\/div>\n<div>\n<ul>\n<li>Your Firstname<\/li>\n<li>Your Surname<\/li>\n<li>Date of Birth<\/li>\n<li>Address<\/li>\n<\/ul>\n<\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif;\">Etc<\/span><\/div>\n<p>&nbsp;<\/p>\n<div>\n<p><span style=\"font-family: 'trebuchet ms' , sans-serif;\">So these pieces of information could be referred to as data.<\/span><br \/>\n<span style=\"font-family: 'trebuchet ms' , sans-serif;\"><br \/>\n<\/span><\/p>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">What is Data Structure?<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">A piece of information(data) could also be a combination of different other pieces of data.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">For example,<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\"><b>Name<\/b> is made up of Firstname, Lastname and Othername<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Students Registration Number could be something like:<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\"><b><i>G2014\/MSC\/COMP\/FT\/295<\/i><\/b><\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Here we see a single piece of data\u00a0 student registration number, made up of different units like:<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><\/div>\n<ul>\n<li><span style=\"font-size: small;\">G \u2013 Graduate<\/span><\/li>\n<li><span style=\"font-size: small;\">MSC \u2013 Masters<\/span><\/li>\n<li><span style=\"font-size: small;\">COMP \u2013 Computer Science<\/span><\/li>\n<li><span style=\"font-size: small;\">FT \u2013 Full Time<\/span><\/li>\n<li><span style=\"font-size: small;\">295 \u2013 Serial number of student in the department<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Another example would be Address, which would be made up of House number, Street, zip code etc.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">So we can define data structure as the way(or structure) different pieces of data is organized\u00a0 and the relationship between them.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Lets now outline the various data structures in use in computer science.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Arrays<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Arrays are the most common data structure in use and it has an implementation in about every programming language.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\"><b>Definition<\/b>: An array is a collections of items of the same data type with the collection having a given name and items arranged in a linear fashion such that each item in the array can be referenced by a given integer called the index or subscript.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Example is Fruit(10) made up of 11 element referenced as follows:<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Fruit[0]<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Fruit[1]<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Fruit[2]<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u2026<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u2026<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Fruit[9]<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Fruit[10]<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">An array data structure is illustrated below<\/span><\/div>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/1.bp.blogspot.com\/-0b_AVMtBWuQ\/WT_4nU3078I\/AAAAAAAAAFc\/QEnSlNgXLKUsfFGwKa0pN27b4fYtcVp7gCEw\/s1600\/Array.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/1.bp.blogspot.com\/-0b_AVMtBWuQ\/WT_4nU3078I\/AAAAAAAAAFc\/QEnSlNgXLKUsfFGwKa0pN27b4fYtcVp7gCEw\/s320\/Array.jpg\" width=\"236\" height=\"320\" border=\"0\" data-original-height=\"422\" data-original-width=\"312\" \/><\/a><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Linked List<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Linked list is a data structure developed to address some of the deficiencies of the Array data structure. In a linked lists, the items are not stored in contiguous manner like arrays. Each item is related to the next item by the use of pointers.\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">This is illustrated by the figure below<\/span><\/div>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-0UjwqTPZDM4\/WT_4nQlxYCI\/AAAAAAAAAFc\/8J79Duc6UsIUcazMNHvLDOVieA4Bm_J9ACEw\/s1600\/Linked_list.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-0UjwqTPZDM4\/WT_4nQlxYCI\/AAAAAAAAAFc\/8J79Duc6UsIUcazMNHvLDOVieA4Bm_J9ACEw\/s640\/Linked_list.jpg\" width=\"640\" height=\"74\" border=\"0\" data-original-height=\"156\" data-original-width=\"1327\" \/><\/a><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Stacks<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">A stack is a linear data structure that allows insertions and deletions to be done only from one end of the list called the top. The last item inserted into the list is always the first item to be retrieved from the list. So a stack support Last In First Out (LIFO) data access.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Add ing an item to the top of a stack is called push while retrieving is called pop.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Stack is mainly applied in procedure call in programs.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Queues<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">A queue is a data structure that allows insertion of items only from one end of the list called the head, while deletions can only be done from the other end called the tail. A queue supports First In First Out(FIFO) data access.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">An application of the queue data structure is print jobs. Job sent to the printer are placed in a queue where the first to be sent is the first to be printed.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Trees<\/span><\/b><\/div>\n<hr \/>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">A tree data structure is a hierarchical non-linear structure having a particular node called the root and other nodes make up the sub-tree(s). A tree have the appearance of an inverted tree, where the root is on top.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Nodes in a tree are connected by edges or branches. The nodes at the lower-most part of the tree with no sub-trees are called the leave nodes.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Tree data structure is shown below<\/span><\/div>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-xIFKTjbrSTI\/WT_4oF-szdI\/AAAAAAAAAFc\/KaERbj3RMBM9hr2y8YLLMsZzHfiKqgIbACEw\/s1600\/Tree.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-xIFKTjbrSTI\/WT_4oF-szdI\/AAAAAAAAAFc\/KaERbj3RMBM9hr2y8YLLMsZzHfiKqgIbACEw\/s640\/Tree.jpg\" width=\"640\" height=\"300\" border=\"0\" data-original-height=\"407\" data-original-width=\"863\" \/><\/a><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Graphs<\/span><\/b><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Just like trees, graphs are non-linear data structures made up of a set of nodes and a set of edges. An edge joins two nodes together.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">A graph can be directed or non-directed, a graph is directed if the edge joining to nodes have a direction and non-directed if the edge have no direction.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Graph data structure is shown below<\/span><\/div>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-lvUoLPNA_TA\/WT_4nSHO4ZI\/AAAAAAAAAFk\/Ok24URuY9rwS2tMrlxGwcwhXJCK7lbb8wCEw\/s1600\/Graph.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-lvUoLPNA_TA\/WT_4nSHO4ZI\/AAAAAAAAAFk\/Ok24URuY9rwS2tMrlxGwcwhXJCK7lbb8wCEw\/s320\/Graph.jpg\" width=\"253\" height=\"320\" border=\"0\" data-original-height=\"492\" data-original-width=\"390\" \/><\/a><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><b><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Dictionary, Hashing and Hash Tables<\/span><\/b><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">Hashing is a techniques applied in the dictionary data structure. Here, two things are used:<\/span><\/div>\n<div><\/div>\n<ul>\n<li><span style=\"font-size: small;\">A Hash Function<\/span><\/li>\n<li><span style=\"font-size: small;\">A Hash Table<\/span><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">The hash function is applied to the key of an element to produce a value to represents the location in the hash table where the element would be stored.<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">\u00a0<\/span><\/div>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">This ends out discussion of Introduction to Data Structures. Spends you time to get used to the concepts and definition of each of the data structures before you drill down to the in-depth study of these data structures.<\/span><\/div>\n<p>&nbsp;<\/p>\n<div><span style=\"font-family: 'trebuchet ms' , sans-serif; font-size: small;\">If you find this helpful, leave a comment to let me know. Thanks for your time.<\/span><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The concept of Data Structures is a very important concept in modern computer science. So, in this course we would examine what data structure is &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[35,414],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":1,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":715,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions\/715"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}