homework

graph theory dfs search

I need help to solve the following question: Write a simple algorithm which gets a simple Connectivity undirected graph to find the order of deletion on top, so that at no stage the Connectivity of the graph is not dropped. Formally: given graph G = (V, E) and a group of vertices, V*, the graph obtained from deleting V* from G is V*= (V-...

dfs search question

Possible Duplicate: graph theory dfs search I need help solving this question: Write an algorithm that given a simple directed graph G = (V, E) generates and returns the component graph (gscc graph) of G in linear time. ...

How to learn if a value is even or odd in bash?

I am building a movie database and I need to find a median for ratings. I'm really new to bash (it's my first assignment). I wrote: let evencheck=$"(($Amount_of_movies-$Amount_of_0_movies)%2)" if [ $evencheck==0 ] then let median="(($Amount_of_movies-$Amount_of_0_movies)/2)" else let median="(($Amount_of_movies-$Amount_of_0_movies)/2...

simulate ARMA model with specific order and parameters value

What is the matlab function to simulate ARMA model and coda matlab function (coda:convergence diagnostic and data analysis) ...

STRING palindrome

hi I need a detail code in java to check string palindrome without using API'S ...

Help needed for writing an algorithm

Here is the description of the the problem Given an integer N, write a function which returns an integer array of size N, containing the numbers from 1 to N in a random order. Each number from 1 to N must appear once and must not repeat. What is the running time of your algorithm? Can your algorithm be improved? For example: if you ...

Structure initializing problem in C

I'm writing a program for a "Set" data structure in C. It's working fine when one instance of Set is present, but it doesn't work when two instances of Set are present. Also my code for removing an element is not working when the candidate is the first element. Can someone help me? Here is the code: Set.h Set.c Test.c ...

Algorithm for finding all permutations for n alphabets

I wrote the following algorithm for finding all possible permutations of n unique alphabets. Set<String> results = new HashSet<String>(); int size = 1; //find the total permutations possible for(int i=0;i<array.length;i++){ size*=(i+1); } // i is the number of items remaining to be shuffl...

find duplicates in integer array with boundaries.

Below is the problem description and algorithm that I have written. Is there anything to be done to improve this algorithm? Given an integer array of unknown size, containing only numbers between 0 and 30, write a function to return an integer array containing all of the duplicates. int[] findDupes(int[] array) { int[] found = new ...

why is the output different in case of &&, &, ||

Here is the code segments Can you explain why outputs are varying 1) public static ShortCkt { public static void main(String args[]) { int i = 0; boolean t = true; boolean f = false, b; b = (t && ((i++) == 0)); b = (f && ((i+=2) > 0)); System.out.println(i); } } output in...

Cannot get values from XML using XSLT

Hi all! I've got a question about XML and XSLT: I have this generated xml: <?xml version="1.0"?> <rootElement> <ClassSection> <Class name="Vehicle" base="Object"> <isPublic /> <isAbstract /> <Field specifier="private" fieldType="Int32" fieldName="numberOfWheels" /> <Field specifier="private" fieldType="In...

Find and Replace in a C File

The Problem was to find and replace a string in a C File. I am new to C Files. I have tried the following code but I didnt get any output: #include<stdio.h> #include<string.h> int main() { FILE *f1,*f2; char *src,*dest,*s1,ch,ch1,ch2,ch3; int i; f1=fopen("input.txt","rw"); f2=fop...

What will be the complexity of the operation to remove an element from the end of the singly linked list ?

What will be the complexity of the operation to remove an element from the end of the singly linked list ? I have implemented linked-list in C. Here is the code for removing a element from the end of linked-list. Now my query is that how to calculate the complexity of this snippet. What are the factors involved. There are other operation...

Function abruptly returns when it shouldn't

I am working on an Operating Systems assignment for one of my summer classes. The teacher has provided an object file that provides functions that mimic the behaviour of a disk device driver. We are then to write a file system API that uses the disk device driver in C. I am working on my file system format function named Format() which ...

How to find the ASCII Characters?

How to write a program to print the ASCII characters of the input given by user? ...

Trying to tokenize a string separated by commas

I'm novice so be gentle. trying to read a file of strings as such: "1,Duck_Soup,1933,Comedy,5,12" and tokenize it to different vars for each of the tokens between the commas. That's my code and I keep getting "segmentation fault" no matter what I try. Please help me fix the code, thank you. For starters I want to make it print the tok...

File sorter in unix

The code should sort the files in the given directory like the "ls" command. Please find exact details below:- File name in alphabetical order, size, mod time. The sort should continue if there is a sub directory. Please reply to this post. Its a bit urgent. Thanks, ...

Explain any one method by which c++ implements polymorphism

Explain any one method by which c++ implements polymorphism....... ...

GNU compiler KEY_F not detecting function keys

Basically, I have key detection for my console application, for some reason it's not detecting function keys. Here is my code, I'm using GNU compiler on linux. Any help or ideas would be greatly appreciated. refresh(); key = getch(); switch(key) { case KEY_HOME: key = HOME; break; ...

Is there a way to debug with the visual studio command prompt?

I've got a project that I need to get working with 3 compilers (borland, gnu, and microsoft). It works on 2/3 and now I just need to get it working with microsofts. It seems to crash in places that it works fine with the other compilers, so I'm wondering if there is a way to debug with the command line, maybe to get a stack trace or ge...