...#include #include struct node { int info; struct node *link; }; struct node *start=NULL,*n,*temp,*temp1; void create(); void display(); void insbeg(); void inspos(); void delbeg(); void delend(); void search(); int main() { int i; printf("------linked list----------\n"); n=(struct node *)malloc(sizeof(struct node)); printf("enter the element:--->"); scanf("%d",&n->info); n->link=NULL; start=n; for(i=0;iinfo); n->link=start; start=n; } void create() { n=(struct node *)malloc(sizeof(struct node)); printf("enter the element--->"); scanf("%d",&n->info); temp=start; while(temp->link!=NULL) { temp=temp->link; } temp->link=n; n->link=NULL; } void display() { printf("The list is:\n"); temp=start; while(temp!=NULL) { printf("%d\n",temp->info); temp=temp->link; } } void inspos() { int pos, count=0; temp=start; if(temp==NULL) count=0; else count=1; printf("enter position."); scanf("%d",&pos); if(pos==1) { insbeg(); return; } n=(struct node *)malloc(sizeof(struct node)); printf("enter the element--->"); scanf("%d",&n->info); while(temp->link!=NULL) { if(count==pos-1) break; temp=temp->link; count++; } n->link=temp->link; temp->link=n; } void delbeg() { temp=start; start=start->link; free(temp); } void delend() { temp=start; while(temp->link...
Words: 251 - Pages: 2
...MinEmail: SMS Alert System for Managing Critical Emails Authors: Kyle Rector and Joshua Hailpern Reviewer: Khawaja Ahmed Ali 1. What is the purpose of the work? Most of the people rely on email as their primary mode of business communication. However, as number of emails increase, it become difficult to manage them. This may leads to the poor attention to some important emails. Missing an important email may cause delay in project progress and frustration in users. There are numbers of manual and automatic procedures to filter emails based on various features. These methods identify the important emails and highlight them in some way. However, all of the methods have some limitations and thus, an end user cannot get full benefits. In this paper, authors presented an alert system for emails. MinEmail uses SMS as a notification tool about important emails. It sends an SMS to notify and remind a user about any critical email. This systems automatically predict and label important emails. Authors developed models to predict how and when emails should be addressed. The primary contribution is not to develop a novel system to combine two different communication methods: Email and SMS, but to propose models for prediction and labeling of critical emails. 2. How do the authors achieve this purpose? Why is the particular approach adopted? Related research shows the three ways of addressing the above mentioned problem: a. Manual Email Management b. Automatic...
Words: 811 - Pages: 4
...Linked List 1 List vs Arrays Two built-in data structures that can be used to organize data, or to create other data structures: • Lists • Arrays Lists A list is an ordered set of data. It is often used to store objects that are to be processed sequentially. Arrays An array is an indexed set of variables, such as dancer[1], dancer[2], dancer[3],… It is like a set of boxes that hold things. A list is a set of items. An array is a set of variables that each store an item. Arrays and Lists You can see the difference between arrays and lists when you delete items. Arrays and Lists In a list, the missing spot is filled in when something is deleted. Arrays and Lists In an array, an empty variable is left behind when something is deleted. What’s wrong with Array and Why lists? • Disadvantages of arrays as storage data structures: – slow searching in unordered array – slow insertion in ordered array – Fixed size • Linked lists solve some of these problems • Linked lists are general purpose storage data structures and are versatile. Linked Lists A Head B C • A linked list is a series of connected nodes • Each node contains at least – A piece of data (any type) – Pointer to the next node in the list • Head: pointer to the first node • The last node points to NULL node A data pointer The composition of a Linked List • A linked list is called "linked" because each node in the series has a pointer that points...
Words: 2375 - Pages: 10
...efficiently that the free contiguous memory in not an requirement for allocating data items • The length of the data items is not necessary to be known prior to allocation Cons • Overhead of the link to the next data item Linked list: linked list a data structure which stores data in the form of nodes.It does not require linear memory as arrays. Each node contains a data part and a pointer part(a pointer to the next data in the list) link or node is object of a class.there are so many types of linked list 1) single linked list 2)doubly linked list 3)circular linked list. single linked list: here links contains pointer to first data and last data in the list.As said earlier a pointer to the next data. example of a linked list: class node{// all nodes will be the objects of this class public int data; public link next_node;//a pointer to next data } public node(int data){ this.data=data; }//end of constructor public void showdata(){ System.out.println("data= "+data); } }//end of class node After defining class for each node we need to define a class for link list. Link list contains a pointer to the first node in the list,Which should be initialized to null in the beginning. All the operations to be performed on the link list is defined as functions in this class. For example insert first,Delete,insert search etc. class linkedlist{ private node first_node;//pointer to the first node is defined public linkedlist(){ first_node=null; } public void...
Words: 475 - Pages: 2
...program is the driver of the whole exercise and uses (includes) all of the .h files of the different linked lists. The main program performs the following steps: 1. It begins by generating N (see below) random integers between 0 and 9 and stores them in a binary file called insert.bin. It should let the user know what numbers were generated and written. 2. It then generates another N random integers between 0 and 9 and stores them in another binary file called delete.bin. It should let the user know what numbers were generated and written. 3. It reads insert.bin one integer at a time and stores the value read into each one of the lists, keeping each list sorted in increasing order. If a number occurs more than once in the list, instead of creating a new node, it increments a count variable on the node. It should let the user know what value it read from the file and it should show the four lists with the new value inserted, identifying each type of list. To display a node, show key and count. 4. Once done reading the insert.bin file, it starts reading the delete.bin file one value at a time, deleting that value from each of the linked lists. If the value occurs in the list more than once (the count member on the node is greater than 1), it decrements the count. It is only when the count is 1 and deleting the node would make it 0 that the node is actually removed from the list and freed. It should let the user know what value it read from the file and it should show...
Words: 290 - Pages: 2
...Near the end of each unit a corresponding homework assignment will be given. De pending on how quickly we finish material, we may end up spending more or less time on each topic. Readings are highly recommended but are not directly evaluated; for example, there are no in-class quizzes about readings. Unit 1 Topics Course Overview C++ Programming Language Basics Functions; Strings; Input/Output Streams Collections, Containers Abstract Data Types (ADTs) Stack/Queue, Vector, Grid, Map, Set, Lexicon Designing Classes Recursion Recursive Algorithms and Data Fractals Recursive Exhaustive Search Backtracking Sorting Algorithm Efficiency; Big-Oh Notation Arrays and Pointers Dynamic Memory Allocation Implementing Collection Classes Hashing Linked Lists Linked Data Structures Binary Trees; Binary Search Trees (BSTs) Graphs Advanced Topics Readings Chapters 1-4 Assignments HW1: Life 2 Chapters 5-6 HW2: Word Ladders, Random Writer 3 Chapters 7-8 HW3: Recursion 4 Chapters 9-10 HW4: Boggle 5 Chapters 11-12, 14 HW5: Priority Queue 6 Chapters 12, 14, 16 HW6: Huffman Encoding 7 Chapters 18-20 HW7: Trailblazer Please note that this is a preliminary rough schedule and is subject to change without advance notice. Refer to the course web site for the most up-to-date information about what topics will be covered, appropriate reading, and assignments. This document is copyright © Marty Stepp, licensed under Creative Commons Attribution 2.5 License...
Words: 268 - Pages: 2
...A linked list is made up of a series of objects, called the nodes of the list. Because a list node is a distinct object. Linked lists are among the simplest and most common data structures. The principal benefit of a linked list over a conventional array is that the list elements can easily be inserted or removed without reallocation or reorganization of the entire structure because the data items need not be stored contiguously in memory or on disk, while an array has to be declared in the source code, before compiling and running the program. Linked lists allow insertion and removal of nodes at any point in the list, and can do so with a constant number of operations if the link previous to the link being added or removed is maintained during list traversal. Singly Linked List: Singly linked lists contain nodes which have a data field as well as a next field, which points to the next node in line of nodes. Operations that can be performed on singly linked lists include insertion, deletion and traversal. Finding and Deleting Specified Link: Finding algorithm Beginning from the head, 1. Check, if the end of a list hasn't been reached yet; 2. Do some actions with the current node, which is specific for particular algorithm; 3. Current node becomes previous and next node becomes current. Deleting 4. Save reference to link 5. Delete it, save first to old next 6. Return deleted link Operation on Singly Link List: * Search * Insert ...
Words: 818 - Pages: 4
...IT 265 Data Structures for Problem Solving Data Structures and Methods 9/20/2014 Phase 5 Contents Executive Summary 4 Phase 1 4 Phase 2 4 Phase 3 4 Phase 4 4 Phase 5 5 Section 1: Lists, Stacks, and Queues 6 Stacks 6 Queues 10 Section 2: Hashing, Heaps and Trees 14 Section 3: Sorting Algorithms 20 Insertion sort 20 Bubble Sort 20 Selection sort 21 Section 4: Searching 22 Array 22 Linked Lists 23 Section 5: Recursion 30 References 33 Executive Summary Phase 1 A list is a collection of items in which the items have a position (Weiss, 2010). A linked list allows data to be input or removed easily because each of the data items in the list is connected to its neighbor by a pointer that can be quickly and easily modified to accommodate new or removed items (CTU M.U.S.E. 2014). The Phase 1 portion of this document will be demonstrating the implementation of Stacks and Queues. Phase 2 Hash tables can be viewed as an array of lists and are used to speed up a search for data by creating a situation that does not require the search to start at the beginning and go through every item. The identifying value is the key and the associated record is the data, thus a hash table is a collection of (key, value) pairs. Phase 3 In order to efficiently use a database, the data must be stored in some sort of order. There are a number of different sorting algorithms; a programmer would choose which one to use depending on the amount...
Words: 3704 - Pages: 15
...STRUCTURES, POINTERS, AND LINKED DATA STRUCTURES • The following slides provide the C-code around which we will structure our discussion tomorrow. • Please note that this code by itself is incomplete. • Class attendance is necessary to understand the theme. • Those who do not attend the class must read the Text book and come to consultations, if help is needed. Structures and Lists #include #include struct Student { char *name ; int age; }; // Note: char *name ="xxxxxxxxxxxxxx"; is // not permitted in structures. Why? int main(void){ struct Student s; // allocates memory. s.name = malloc(20*sizeof(char)); scanf("%s",s.name); s.age = 20; printf("1:%s %d\n",s.name, s.age); struct Student *ps; ps = &s; // Dot has higher priority over & scanf("%s%d",(*ps).name,&(*ps).age); printf("2:%s %d\n", (*ps).name, (*ps).age); printf("3:%s %d\n",ps->name,ps->age+3); struct Student *ps1; // allocate memory by malloc() dynamically. ps1 = malloc(sizeof(struct Student)); ps1->name = malloc(20*sizeof(char)); scanf("%s%d",ps1->name,&(ps1->age)); printf("4:%s %d\n",ps1->name,ps1->age+3); printf("5:%s %d\n", (*ps1).name, (*ps1).age); } Student s 0028FF08 malloc 003C1110 name name age age ps malloc 0028FF00 003C1188 ps1 malloc #include #include struct S1 { int a1; char b1; }; struct S2{ int a2; char b2; struct S1 *p2; }; struct S3{ int a3; char b3; struct S1 *p3a; struct S2 *p3b; }; Linked structures // Self...
Words: 1984 - Pages: 8
...An array is defined as a sequence of objects of the same data type. All the elements of an array are either of type int (whole numbers), or all of them are of type char, or all of them are of floating decimal point type, etc. An array cannot have a mixture of different data types as its elements. Also, array elements cannot be functions; however, they may be pointers to functions. In computer memory, array elements are stored in a sequence of adjacent memory blocks. Since all the elements of an array are of same data type, the memory blocks allocated to elements of an array are also of same size. Each element of an array occupies one block of memory. The size of memory blocks allocated depends on the data type and it is same as for different data types. Often, we have to deal with groups of objects of same type such as names of persons, instrument readings in an experiment, roll numbers of students, and so on. These groups can be conveniently represented as elements of arrays. The declaration of array includes the type of array that is the type of value we are going to store in it, the array name and maximum number of elements. Examples: short val[200]; val[12] = 5; Declaration & Data Types Arrays have the same data types as variables, i.e., short, long, float etc. They are similar to variables: they can either be declared global or local. They are declared by the given syntax: Datatype array_name [dimensions] = {element1,element2,….,element} The declaration form...
Words: 7409 - Pages: 30
...Linked List Problems By Nick Parlante Copyright ©1998-2002, Nick Parlante Abstract This document reviews basic linked list code techniques and then works through 18 linked list problems covering a wide range of difficulty. Most obviously, these problems are a way to learn about linked lists. More importantly, these problems are a way to develop your ability with complex pointer algorithms. Even though modern languages and tools have made linked lists pretty unimportant for day-to-day programming, the skills for complex pointer algorithms are very important, and linked lists are an excellent way to develop those skills. The problems use the C language syntax, so they require a basic understanding of C and its pointer syntax. The emphasis is on the important concepts of pointer manipulation and linked list algorithms rather than the features of the C language. For some of the problems we present multiple solutions, such as iteration vs. recursion, dummy node vs. local reference. The specific problems are, in rough order of difficulty: Count, GetNth, DeleteList, Pop, InsertNth, SortedInsert, InsertSort, Append, FrontBackSplit, RemoveDuplicates, MoveNode, AlternatingSplit, ShuffleMerge, SortedMerge, SortedIntersect, Reverse, and RecursiveReverse. Contents Section 1 — Review of basic linked list code techniques Section 2 — 18 list problems in increasing order of difficulty Section 3 — Solutions to all the problems 3 10 20 This is document #105, Linked List Problems, in the...
Words: 7907 - Pages: 32
...CS301 – Data Structures ___________________________________________________________________ Data Structures 1 CS301 – Data Structures ___________________________________________________________________ Data Structures..........................................................................................................1 Lecture No. 01 ............................................................................................................3 Lecture No. 02 ..........................................................................................................12 Lecture No. 03 ..........................................................................................................21 Lecture No. 04 ..........................................................................................................34 Lecture No. 05 ..........................................................................................................49 Lecture No. 06 ..........................................................................................................59 Lecture No. 07 ..........................................................................................................66 Lecture No. 08 ..........................................................................................................73 Lecture No. 09 ..........................................................................................................84 Lecture No. 10 ....................................
Words: 13571 - Pages: 55
... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 3 4 4 6 6 7 7 7 I Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . reverse order . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 9 9 10 10 11 12 13 13 15 15 16 17 19 20 21 22 24 24 25 26 26 2 Linked Lists 2.1 Singly Linked List . . . . . 2.1.1...
Words: 23014 - Pages: 93
...the following postfix expression using a stack and show the contents of stack after execution of each operation : 50,40,+,18, 14,-, *,+ Question 6 Evaluate the following postfix expression using a stack and show the contents of stack after execution of each operation : TRUE, FALSE, TRUE, FALSE, NOT, OR, TRUE, OR, OR, AND Question 7 Write a program for creating polynomial using linked list? Question 8 Each node of a STACK contains the following information, in addition to required pointer field : i) Roll number of the student ii) Age of the student Give the structure of node for the linked stack in question TOP is a pointer which points to the topmost node of the STACK. Write the following functions. i) PUSH() - To push a node to the stack which is allocated dynamically ii) POP() - To remove a node from the stack and release the memory. Question 9 Write a function in C to perform a DELETE operation in a dynamically allocated link list considering the following description : struct Node {...
Words: 357 - Pages: 2
...variable-aggregate data type 线性表 linear list 栈 stack 队列 queue 串 string 数组 array 树 tree 图 grabh 查找,线索 searching 更新 updating 排序(分类) sorting 插入 insertion 删除 deletion 前趋 predecessor 后继 successor 直接前趋 immediate predecessor 直接后继 immediate successor 双端列表 deque(double-ended queue) 循环队列 cirular queue 指针 pointer 先进先出表(队列) first-in first-out list 后进先出表(队列) last-in first-out list 栈底 bottom 栈定 top 压入 push 弹出 pop 队头 front 队尾 rear 上溢 overflow 下溢 underflow 数组 array 矩阵 matrix 多维数组 multi-dimentional array 以行为主的顺序分配 row major order 以列为主的顺序分配 column major order 三角矩阵 truangular matrix 对称矩阵 symmetric matrix 稀疏矩阵 sparse matrix 转置矩阵 transposed matrix 链表 linked list 线性链表 linear linked list 单链表 single linked list 多重链表 multilinked list 循环链表 circular linked list 双向链表 doubly linked list 十字链表 orthogonal list 广义表 generalized list 链 link 指针域 pointer field 链域 link field 头结点 head node 头指针 head pointer 尾指针 tail pointer 串 string 空白(空格)串 blank string 空串(零串) null string 子串 substring 树 tree 子树 subtree 森林 forest 根 root 叶子 leaf 结点 node 深度 depth 层次 level 双亲 parents 孩子 children 兄弟 brother 祖先 ancestor 子孙 descentdant 二叉树 binary tree 平衡二叉树 banlanced binary tree 满二叉树 full binary tree 完全二叉树 complete binary tree 遍历二叉树 traversing binary tree 二叉排序树 binary sort tree 二叉查找树 binary search tree 线索二叉树 threaded binary tree 哈夫曼树 Huffman tree 有序数 ordered tree 无序数 unordered tree 判定树 decision tree 双链树 doubly linked tree 数字查找树 digital search tree ...
Words: 1522 - Pages: 7