最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

algorithm - linear Data Structure and Non linear Data Structure - Stack Overflow

programmeradmin0浏览0评论

I don't understand linear Data Structure and Non linear Data Structure difference

I want to Learn Programming. And I want to know Data. I want to understand for education.

Can someone explain with examples? I am learning programming and want to understand how data structures work, their importance, and where they are used in real applications.

I don't understand linear Data Structure and Non linear Data Structure difference

I want to Learn Programming. And I want to know Data. I want to understand for education.

Can someone explain with examples? I am learning programming and want to understand how data structures work, their importance, and where they are used in real applications.

Share Improve this question asked Jan 30 at 4:24 Kaung Thant ZawKaung Thant Zaw 413 bronze badges 1
  • Where did you come across these terms? – Bergi Commented Jan 30 at 7:21
Add a comment  | 

1 Answer 1

Reset to default 2

Linear Data Structure are those which are anised and can be traversed linearly. For example List (Arrays, Linked List) they are anized in a way where from one position traversal is linear (back or forward) to next/previous position. There is maximum of only 1 predecessor and maxium of only 1 successor. This creates a linear 1 to 1 relationship. This also ensures a sequential ordering (Arrays uses contiguous memory where as Linkedlist may not use contiguous memory but still conceptually arranged in linear sequence, where a node has a link to next or previous node)

Non Linear Data structures are those which has one to many or even many to many relationship. Examples are trees or graphs. Instead of simple previous or next here a position may have link to multiple positions.

Examples

Consider a social media where one person may have many friends and each friend may have multiple others and these friends may or may not be friends of each other. Here there is no one to one relationship but many to many relationship. Traversal is complex and non linear. This data can be represented by a non linear data structure.

Now consider a list of first 5 Presidents of a country. This data can be represented by an array or linked list. This is an example of linear data structure.

发布评论

评论列表(0)

  1. 暂无评论