answersLogoWhite

0

📱

Computer Programming

A category for questions about computer programming and programming languages.

10,506 Questions

How do you write a C program to implement stacks through arrays?

#include<stdio.h>

#include<conio.h>

#define MAX 10

typedef struct stack

{

int item[MAX];

int Top;

}stk;

void createstack(stk *);

void push(stk *,int);

int pop(stk *);

int isempty(stk *);

int isfull(stk *);

int main()

{

int choice;

int value;

stk s;

createstack(&s);

do{

clrscr();

printf("\n\t Main Menu");

printf("\n1. Push");

printf("\n2. Pop");

printf("\n3. Exit");

printf("\nEnter your choice=");

scanf("%d",choice);

switch(choice)

{

case 1: printf("\nEnter the value to be inserted=");

scanf("%d",value);

push(&s,value);

getch();

break;

case 2: value=pop(&s);

if (value==0)

printf("\n Underflow: Stack is empty");

else

printf("\n Popped Element is %d",value)

getch();

break;

case 3: exit();

defualt: printf("\nInvalid choice");

}

}while(1);

return 0;

}

void createstack(stk *s)

{

s->Top=-1;

}

void push(stk *s,int element)

{

if(isfull(s))

{

printf("\nOverflow: Stack is full");

return;

}

s->Top++;

s->item[s->Top]=element;

printf("\nValue is pushed onto the stack");

}

int pop(stk *)

{

int popped;

if (isempty(s))

return 0;

popped=s->item[s-.Top];

s->Top-;

return popped;

}

int isempty(stk *)

{

return s->Top==-1;

}

int isfull(stk *)

{

return s->Top==MAX-1;

}

Is there any converter available for pdf to Excel?

You can download Speedpdf Converter. Although the software needs to be downloaded and installed, the batch and local conversion functions without downloading are really very efficient.

After opening the software, select PDF to Excel, and drag all the PDF documents that need to be converted to the conversion page.

Before the conversion, we can modify the save location of the converted document through the output roadbed in the lower left corner of the conversion page, so that the converted Excel table file can be viewed directly in the corresponding folder, and click Start conversion in the lower right corner to batch batch Deal with it.

What is the difference between linear search and binary search?

A linear search looks for an item in a list by iterating through it sequentially. Meaning that it looks at the first item, then the second item, then the third item, then the fourth and etc...

Because it is possible that the item you are looking for is the very last item in the list, a linear search runs in O(n) time. For a *randomly* ordered list, the search will run on average in n/2 time.

A binary search is a much more efficient algorithm which can only be used on a SORTED list. A binary search is conceptually equivalent to treating the list as a binary search tree. Because the depth of a balanced binary search tree is log n, a binary search algorithm runs in O(log n) time.

Instead of starting at the beginning of the list, a binary search starts in the middle of the sorted list. If the item it is looking for is less than the item in the middle of the list, then you look in the middle of the half of the list which is less than the middle item. If the item it is looking for is greater than the middle item, then it looks in the middle of the half of the list which is greater than the middle item. This process repeats until you either find what you are looking for, or the size of the sublist that you are looking in is zero.

Is a Wii an artificial intelligence machine?

If you are talking about the Nintendo Wii Console - then the answer is a direct "No"

But if you talk about the games developed for Wii - Then the answer is "Yes" because most of the games ( High - end) use advance AI for characters ( Entities ) in their games.

Write a PHP program to check whether the number is palindrome or not?

This program only suits PHP. If you want a proper one try C program for it available on web

<body>

<?php

if(isset($_POST['submit']))

{

$text = $_POST['text'];

$string = mysql_real_escape_string($text);

$invert = strrev($string);

if($string == $invert)

{

echo "<br>Given number is a palindrome!!";

}

else

{

echo "<br>Given number is not a palindrome!!";

}

}

?>

<form method="post">

<input type="text" name="text" id="text" />

<input type="submit" name="submit" value="Submit" id="submit" onclick="<?php $_SERVER['PHP_SELF']; ?>" />

</form>

</body>

Fifo what do that mean explain please?

In computing:
FIFO means First In First one.
Data are normally queued up and processed sequentialy(one after the other).
In FiFo,the data which is first in the queue;i.e in front is first executed,followed by the next and so on.
Therefore,FIFO makes use the principle,"First come First served"

What are social queues?

A social queue is the ability to pick up on, or read someones behavior, and then act upon good judgement to not interefere with said behavior. Examples:

Scenario 1: If someone obviously looks busy, you dont bother them.

Scenario 2: If someone is sleeping, you do not wake them.

Along with said social queues, there will always be that one person who can't quite understand and will cross that invisible boundary. Do everyone a favor and pick up on those social queues so you aren't "that person."

Ascending and descending oreder using functions in c language?

Well There is no "functions"

but there is a way:

#include

main()

{

int n,num;

printf("Enter Number");

scanf("%d",n);

num = n%2;

if(n==1)

{

printf("Your number is Odd");

}

else

{

printf("Your number is Even");

}

return 0;

}

What is a sentinel in programming?

A real-world sentinel is a soldier or guard, someone who keeps watch. In programming, a sentinel is typically a "dummy" node that is used specifically to mark the beginning or end of a data sequence. If we consider a singly-linked list (also known as a forward list), each node points forwards to the next node in the sequence. When we insert a new node into a list, we typically specify the node that will come immediately before it in the sequence because that node also points to the node that will (ultimately) come after it. Thus our algorithm can be encoded as follows:

void insert_after (Node* node, Node* prev) {

assert (node);

assert (prev);

node->next = prev->next;

prev->next = node;

}

This is fine until we try and insert a new node at the start of the sequence or try to insert into an empty list. In both cases, p will be a null pointer because there can be no node that can come before the new node, n. Thus the assertion that p is non-null will fail. To cater for this, we must over-complicate the algorithm by testing for each of these special cases and, in order to do so, pass another argument to the function, namely the list itself:

void insert_after (List* list, Node* node, Node* prev) {

assert (list);

assert (node);

if (!list->head) { /* cater for empty list */

assert (!prev);

list->head = node;

node->next = null;

} else if (!prev) { /* insert at head of list */

node->next = list->head;

list->head = node;

} else {

node->next = prev->next;

prev->next = node;

}

}

However, if we place a sentinel at the beginning of the list, we guarantee that even an empty list will always have at least one node (the sentinel) and that whenever we insert a new node into the list there will always be a node that can come before that new node. Thus our original function works efficiently without having to deal with any special cases.

The sentinel node is similar to any other node except that it does not store any data, it simply points to the first node in the sequence or to null if the list is empty.

How do you unlock a CD-R?

CD-R are read only. Double-click it to open it and copy them in to a new folder then eject the CD. Go to your Disk Utlitity and create a new one then double click on the disk image to open it then drag the contents of the folder in to the image window then eject the image.

Write a c program to print the given no is palindrome or not using for loop?

#include<stdio.h>

#include<conio.h>

void main()

{

int n,s=0,m;

clrscr();

printf("enter any no");

scanf("%d",&n);

m=n;

while(n>0)

{

r=n%10;

s=s*10+r;

n=n/10;

}

if(s == n) // This is important step

printf("the no is palindrome");

else

printf("no is not palindrome");

getch();

}

How many margins does a typical letter have?

A letter typically has 4 margins. Anytime it would have margins in any other format would be for a specific purpose. For example: say a teacher, or someone you are working for, etc. asks you to write a letter to their specific margins, they may ask you instead of 4 write 2 or 3...or even 1. I hoped this helped!

Who made the word debugging?

There is some controversy over the origin of the term "debugging." The terms "bug" and "debugging" are both popularly attributed to Admiral Grace Hopper in the 1940s[1]. While she was working on a Mark II Computer at Harvard University, her associates discovered a moth stuck in a relay and thereby impeding operation, whereupon she remarked that they were "debugging" the system. However the term "bug" in the meaning of technical error dates back at least to 1878 and Thomas Edison (see the Software bug article for a full discussion), and "debugging" seems to have been used as a term in aeronautics before entering the world of computers. Indeed, in an interview Grace Hopper remarked that she was not coining the term. The moth fit the already existing terminology, so she saved it. The Oxford English Dictionary entry for "debug" quotes the term "debugging" used in reference to airplane engine testing in a 1945 article in the Journal of the Royal Aeronautical Society, Hopper's bug was found 9 September 1947. The term was not adopted by computer programmers until the early 1950s. The seminal article by Gill [2] in 1951 is the earliest in-depth discussion of programming errors, but it does not use the term "bug" or "debugging". In the ACM's digital library, the term "debugging" is first used in three papers from 1952 ACM National Meetings.[3][4][5] Two of the three use the term in quotation marks. By 1963, "debugging" was a common enough term to be mentioned in passing without explanation on page 1 of the CTSS manual.[6] Kidwell's article Stalking the Elusive Computer Bug[7] discusses the etymology of "bug" and "debug" in greater detail

What is a slavery task system?

The task system used during slavery allowed some slave to work unsupervised as long as they completed their assigned task within the alloted time. After completion of the task some slaveowners permitted their slaves to spend their time working for themselves.

What is templet in Microsoft Word?

A template in Microsoft Word is something that lays out a specific way to type for you. The resume template will allow you to type up your resume in an appropriate way.

What is a variable used in computer gaming?

it depends, if its a desired variable, its a program, but if its undesired, its a glitch

How do low level program languages interact with high level program languages?

Both must be translated into a common language. That language is machine code, the native language of the machine.

Which accepts an integer array of size n and prints every third value of the array?

You can loop through the array, and print out every third element. If the index used for looping is called "i", you can test whether "i" is a multiple of three (i % 3 == 0).

Or, and perhaps more efficiently, you can increase the index 3 at a time, for example:

for (i = 0; i <= theArray.length, i+=3)

{

...

}

How can you download movies from bit torrent program?

Download uTorrent from Tucows.com and install it. Go to www.torrentz.com and type in your request. The file will be save in "downloads" on windows. Sometimes the files are Tar'd, you need WinTar to uncompress and compile the files. Also download VLC and us it as your default player. This is a complex question. You need to have someone come over and instruct you if you are not computer savy

Which important property do stack algorithm have?

They will scratch and mess up. They will scratch and mess up. They will scratch and mess up. They will scratch and mess up. They will scratch and mess up. They will scratch and mess up.

What is a programming in c?

C language is developed by Dennis Ritchie at Bell Laboratories in 1972. To know more about C Programming and learn C Programming from basics to advance visit codeforhunger. com

What is peetas skill?

Peeta's skills are camouflage, painting, and baking!