homework

Extended Huffman code

Hello, I have this homework: finding the code words for the symbols in any given alphabet. It says I have to use binary Huffman on groups of three symbols. What does that mean exactly? Do i use regular Huffman on [alphabet]^3? If so, how do I then tell the difference between the 3 symbols in a group? ...

Delete Duplicate from an Array

Hi, I received one question "How to delete duplicate entries from an array" Constrain: No new data structure and same array should return only distinct element. So for example If my array is 1,3,3,3,5,55,67,1 then the result should be 1,3,5,55,67 I have solved the problem public void DeleteDuplicate(int[] array) { int ...

C: Creation of ordered list by checking 2 values

Hello, I'm new to C so be patient with me if you see some really newbie error in my code! As part of a homework, I need to create an ordered list in order to store some data. What I've done so far is to create the struct which will represent each node of the list (firstNode is a global variable that points to the first node of the list...

C++ error C2059

Solved When I try to compile this program i keep getting these errors: (50) : error C2059: syntax error : '<=' (50) : error C2143: syntax error : missing ';' before '{' (51) : error C2059: syntax error : '>' (51) : error C2143: syntax error : missing ';' before '{' (62) : error C2059: syntax error : 'else' (62) : er...

C pointers to functions

I am working on a program that sorts its input lines alphabetically/numericaly depending on the arguments passed to main. And this is the follow-up exercise: Add a field-handling capability, so sorting may be done on fields within lines, each field sorted according to an independent set of options. (The index for this book was sorted wi...

How do I compute the capacity of a hard disk?

I have a worked example of how to compute the capacity of a hard disk, could anyone explain where the BOLD figures came out of? RPM: 7200 no of sectors: 400 no of platters: 6 no of heads: 12 cylinders: 17000 avg seek time: 10millisecs time to move between adj cylinders: 1millisec the first line of the answer given to me is: 12 x...

Collections framework to to count a file

I am using a MSDOS to pipe in a file.. I am trying to write a program that counts how many times each word pair appears in a text file. A word pair consists of two consecutive words (i.e. a word and the word that directly follows it). In the first sentence of this paragraph, the words “counts” and “how” are a word pair. What i want the ...

big O notation of this code

int ara(int dizi[], int ilk, int son, int deger) { int indeks; if ( ilk > son ) return 0; indeks = (ilk + son) / 2; if ( dizi[indeks] < deger ) return ara(dizi, indeks+1, son, deger); else if ( dizi[indeks] > deger ) return ara(dizi, ilk, indeks-1, deger); else ...

Special Binary Tree

What is the name of the binary tree (or the family of the binary trees), that is balanced, and has the minimum number of nodes possible for its height? Well this is special kind of tree not the AVL tree. ...

Haskell: Composing two error-raising functions

The problem I have been given says this: In a similar way to mapMaybe, define the function: composeMaybe :: (a->Maybe b) -> (b -> Maybe c) -> (a-> Maybe c) which composes two error-raising functions. The type Maybe a and the function mapMaybe are coded like this: data Maybe a = Nothing | Just a mapMaybe g Nothing...

Help with bitwise expression

I want a one line code to check whether a given integer is of form 2i - 2j or NOT. (using bitwise operators) I tried to do it but I don't seem to be getting the answer. Can anyone please help me with this? It's kinda urgent... :-| Thanks. ...

speech recognition project

hello im making my final year project i.e. speech recognition.but i dont have nay idea how to start.i will use c#.plz can anyone guide me how to start.what shoul be the first step? thnx ...

help with byte array

I have one byte array which has some raw data like 1aa23486b2..and so on. I want to represent each byte in the array as a decimal number. I then have to go through the decimal numbers and pick out the first x decimal to output to screen. if i use int byte [same size as input byte array] would that work? just declare and initialized it ...

Relational algebra - what is the proper way to represent a 'having' clause?

Yes, this is a homework question but the names have been changed to protect the innocent. Meaning, I am not asking the homework question itself, but rather a small part of it so I can understand the whole. Let's say you have a SQL query like this: --The query would list car prices that occur more than once. select car_price from cars ...

Purpose and Name of this Sequence

C(n)= 2nCn * 1/(n+1) The above sequence is used to find the possible no. of binary search trees, I want to know that what is the name of above sequence and the purposes for which this sequence can be used efficiently. ...

Write a function that compares two strings and returns a third string containing only the letters that appear in both

Hi All, I got this homework. And have solved it in following way. I need your comments whether it is a good approach or I need to use any other data sturcture to solve it in better way. public string ReturnCommon(string firstString, string scndString) { StringBuilder newStb = new StringBuilder(); if (firstString...

Open-form and Closed form

How can an open-form of recurrence be converted into its equivalent closedform. Furthermore, what are some commonly used closed-forms that are usually used efficiently. ...

write a function to divide a number by 3 without using /, % and * operators . itoa() avalable ?

I tried myself to solve but I could not get any clue. Please help me to solve this. ...

C++ error LNK2019 && fatal error LNK1120: 1 unresolved externals

I am trying to work on a homework assignment for school and am going above what the teacher is asking for the assignment -> I have created a "list" class. I keep running into these two errors after adding the 'add()' method to the program - along with the 'newIncomeTax()' methods error LNK2019: unresolved external symbol "public: voi...

Problem with code for For Loop

Hi, I am doing a project for school and I'm really struggling to understand how to create the code/commands for my for loop in Javascript. Any help would be greatly appreciated. The project is basically this: -There are two arrays: one set of 10 French words another with a set of 10 Engish words. They look like this: var english=new A...