C programming Zone

    All Latest C Programming related articles. to submit your articles became a membur, it's free or send your article to publisher(at)tutorialsforu(dot)info.

 



Finding a Loop in a Singly Linked List

E-mail

Motivation

A singly linked list is a common data structure familiar to all computer scientists. A singly linked list is made of nodes where each node has a pointer to the next node (or null to end the list). A singly linked list is often used as a stack (or last in first out queue (LIFO)) because adding a new first element, removing the existing first element, and examining the first element are very fast O(1) operations.

When working with singly linked list, you are typically given a link to the first node. Common operations on a singly linked list are iterating through all the nodes, adding to the list, or deleting from the list. Algorithms for these operations generally require a well formed linked list. That is a linked list without loops or cycles in it.

If a linked list has a cycle:

  • The malformed linked list has no end (no node ever has a null next_node pointer)
  • The malformed linked list contains two links to some node
  • Iterating through the malformed linked list will yield all nodes in the loop multiple times

A malformed linked list with a loop causes iteration over the list to fail because the iteration will never reach the end of the list. Therefore, it is desirable to be able to detect that a linked list is malformed before trying an iteration. This article is a discussion of various algorithms to detect a loop in a singly linked list.

Read more... [Finding a Loop in a Singly Linked List]
 

Algorithms in C

E-mail
This book provides a comprehensive collection of algorithms implemented in C programming language. A variety of algorithms are described in each of the following areas: sorting, searching, string-processing, and geometric, graph, and mathematical algorithms. These algorithms are expressed in terms of concise implementations in C, so that readers can both appreciate their fundamental properties and [...]



Read Full Article
 

Binary Trees

E-mail
A binary tree is made of nodes, where each node contains a “left” pointer, a “right” pointer, and a data element. The “root” pointer points to the topmost node in the tree. The left and right pointers recursively point to smaller “subtrees” on either side. Stanford CS Education Library: introduces the basic concepts of binary trees, [...]


Read Full Article
 

256-Color VGA Programming in C

E-mail
David Brackeen has a very good tutorial on VGA graphics programming for DOS in C programming. The tutorial is a five part C programming tutorial which covers VGA basics, Primitive Shapes & Lines, Bitmaps & Palette Manipulation, Mouse Support & Animation and Double Buffering, Page Flipping, & Unchained Mode. This tutorial covers many topics [...]


Read Full Article
 

The Secret to Learning Anything

E-mail
Some of the most important lessons I learned in college came from one professor, Michael Mitzenmacher. Now, this was a guy with a lot of papers to his name, tenured at Harvard, working on some pretty darn complicated computer science theory (I took his algorithms class). So you'd expect that I'd learn something important. But as it turned out, the biggest lessons I learned from him weren't on the topics he taught. I learned a secret that helped me learn much more effectively.



Read Full Article
 

C Programming Tips by Philip Guo

E-mail
Philips Guo at Stranford University has useful collection of C programming lessons which may be quite useful if you are new to C programming. Guo starts by answering the simple question of why someone should start programming in C language. This is the first question you should ask yourself before sitting down to [...]


Read Full Article
 

C For Engineers & Scientists, An Interpretive Approach with Companion CD

E-mail
C for Engineers and Scientists is designed to teach students how to solve engineering and science problems using C. This is a complete and comprehensive introduction to computer programming in C language, with introductions to object oriented programming in C++, and graphical plotting and numerical computing in C/C++ interpreter Ch and MATLAB for applications in [...]



Read Full Article
 

Programming Practice Problem - Computing File Size

E-mail
In this challenge, given the name of a file, print out the size of the file, in bytes. If no file is given, provide a help string to the user that indicates how to use the program. You might need help with taking parameters via the command line or file I/O in C++ (if you want to solve this problem in C, you might be interested in this article on C file I/O).



Read Full Article
 
« StartPrev12345NextEnd »

Page 1 of 5

Donate

Development & maintainance needs time & money.
With your donation you can help us to keep this project alive
Donate:
  Monthly Monthly
Currency
Amount

Language Translator

Amazon

Copyright @ 2008 | Tutorialsforu.info | Developed by Open Source Coders | Add your link.