Singly Linked List Using Arrays

My Singly Linked List Article is a direct implementation of Singly Linked List, where the memory allocation of more Nodes is done only when necessary. However, in reality, the computer memory is a contiguous array of memory locations. We can emulate the memory management of a Singly Linked List using Arrays.

Linked List

Linked List is a set of Nodes where a Node is a data and a reference to the next node. The reference to the next node is an item required in the structure of a Linked List because it's not organized sequentially in memory like the Array, although it can also be represented using Arrays as you will see in our implementation of Singly List.

Accessing an element:

Singly Linked List

Singly Linked List is the most basic of Linked List implementations. It's a one-way list of Nodes from Head to Tail! 

To implement a Singly Linked List, we must first create a Node structure (or a class) that will hold the data and the node reference to the next Node.

In C++ we do this by declaring the following SL_Node structure. We will be using templates so we can handle different kinds of data in one single program.

Types of Programmers by Skill Level

In my 27-year programming career (including the time when I was 13), I could say that I've encountered almost all types of programmers by their skill in programming, here's a list including the rarity (or ordinariness) of their class in the Philippine industry.

How to Draw a Point in C++ / SDL

Drawing a point on the screen is the first function that one may search in graphics programming. Plotting a pixel is the basic unit of all other graphical objects we see in everyday computing. In this article, we will take a look at how it is done using SDL's surface buffer.

Assuming you've already configured your SDL "includes" and 'libraries", we start the program by initializing the SDL libraries. Initializing SDL Video is the first step before using any of its graphic functions. You do this by:

Tags:

How to Draw a Circle (Midpoint and Bresenham's Algorithm)

With trigonometry functions such as sine and cosine, it is very easy to compute for the value of x and y for any given radius and teta.

We've all learned this from highschool and college class and it will not be tacked in this article. However, drawing a circle using these functions requires the usage of floating-point numbers which is slow, not to mention the typecasting from floating-point to integers as plotting a pixel requires such datatype.

How to Draw a Line (Bresenham's Algorithm)

The line equation represented by y = mx + b, is one of the most basic formulas in plotting a line. Where m represents the slope, x represents the value in horizontal coordinate and b represents the offset from y.

Suppose we have a line segment (x1, y1) to (x2, y2), the slope can be easily computed as (y2 - y1) / (x2 - x1) or to understand it better, we can read it as an increment in y for every step in x.

How to Represent Float Increments as Integer

If you've always hated incrementing (or decrementing) float variables by some constant float within the range of -1 0 1, and increment 0, and wanted to implement a better approach by using integral data types (such as char, short, int, and long), then this article best describes the solution to your ordeal. Applications of this optimization vary from different fields of computer programming. One of which is Bersenham's Algorithm for drawing a line.

How to Implement Image Scale and Crop

If you've ever worked with Adobe Photoshop or any image processing tool, you've probably resized an image to a certain frame or dimension. Suppose the original image dimension is 600x800 (3:4 aspect ratio) and you want to fit everything in a 500x750 (2:3 aspect ratio) frame. What you will do is to shrink the width from 600 to 500 and stretch the height from 800 to 750. This process of resizing is called image scaling in computer graphics.

Tags:

Scale and Crop Images by Folder

Scale and Crop is a Windows and Command-line based program by Everett Gaius Vergara to batch convert JPG and PNG images to the specified dimension size without stretching the images. This particular tool is useful for reducing the file size and correcting the aspect ratio of images. 

Tags:

Subscribe to Everett Gaius Vergara RSS