Skip to contentSkip to conversation

A C program to merge content of 2 binary tree

DISCUSSION Jogesh Kanojia 5 participants 6 messages May 11, 2004

lore
Share & tools
lore
#0 lore raw

Hi
can any body help me in writing a C program to merge the contents of two binary search trees into one. What are the time and storage complexities of program?

i am no that good in data structure

Regards,
Jogesh Kanojia,
Sr. Software Engineer.
Patni Computer Systems Limited
Mobile:- +91 9820275701
Tel:+91-22-27611090 Ext.4018

#2 lore raw

Help in Shell script

Hi

I want shell programs for the following:

(a)  To find the smallest number among the 3 numbers given.
(b)  To check whether the given string is a palindrome or not.
(c)  To sort the given list of numbers in descending order.
(d)  To check, how many times a given substring occurs in a given main

string.
(e) To find the factorial of a given number

If any one have this do send it to me

Regards,
Jogesh Kanojia,
Sr. Software Engineer.
Patni Computer Systems Limited
Mobile:- +91 9820275701
Tel:+91-22-27611090 Ext.4018

#1 lore raw

Re: A C program to merge content of 2 binary tree, etc.

In reply to Jogesh Kanojia

Hello, Jogesh.

Quoted 5 lines · Jogesh Kanojia

can any body help me in writing a C program to merge the contents of two binary search trees into one. What are the time and storage complexities of program?

i am no that good in data structure

Quoted 8 lines · Jogesh Kanojia

I want shell programs for the following:

(a)  To find the smallest number among the 3 numbers given.
(b)  To check whether the given string is a palindrome or not.
(c)  To sort the given list of numbers in descending order.
(d)  To check, how many times a given substring occurs in a given main string.
(e)  To find the factorial of a given number

If any one have this do send it to me

How about you try doing your own homework for school instead of asking someone else to do it for you?

Quoted 3 lines

Regards,
Jogesh Kanojia,
Sr. Software Engineer.

I don't know whether that's funny or sad. Both, I suppose.

Quoted 3 lines

Patni Computer Systems Limited
Mobile:- +91 9820275701
Tel:+91-22-27611090 Ext.4018

On the other hand, if you seriously need help solving these kinds of problems, I am available to do small projects and can provide a quote for services if you contact me off-list. I expect there are multiple other folks on the list who could also provide such services for hire.

--
Jeff Woods <[email protected]>

#3 lore raw

Re: Help in Shell script

In reply to Jogesh Kanojia

It seems someone wants us not only to do his homework for him, but also seems to think that a listserv on programming in c for linux is the right place for questions on shell scripting and OOP. I'd be willing to bet that most of the people here probably know C++ as well as they know C, but shell scripting? There may be someone unethical enough to do your homework for you, but I hope not.

Sincerely,
John T. Williams
(Doing my own damn school work)

Quoted 24 lines · Jogesh Kanojia

Hi

I want shell programs for the following:

(a)  To find the smallest number among the 3 numbers given.
(b)  To check whether the given string is a palindrome or not.
(c)  To sort the given list of numbers in descending order.
(d)  To check, how many times a given substring occurs in a given main

string.
(e) To find the factorial of a given number

If any one have this do send it to me

Regards,
Jogesh Kanojia,
Sr. Software Engineer.
Patni Computer Systems Limited
Mobile:- +91 9820275701
Tel:+91-22-27611090 Ext.4018

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: Help in Shell script

Quoted 7 lines · John T. Williams

It seems someone wants us not only to do his homework for him, but also seems to think that a listserv on programming in c for linux is the right place for questions on shell scripting and OOP. I'd be willing to bet that most of the people here probably know C++ as well as they know C, but shell scripting? There may be someone unethical enough to do your homework for you, but I hope not.

Quoted 21 lines

Sincerely, John T. Williams
(Doing my own damn school work)

Quoted 16 lines · Jogesh Kanojia

Hi

I want shell programs for the following:

(a)  To find the smallest number among the 3 numbers given.
(b)  To check whether the given string is a palindrome or not.
(c)  To sort the given list of numbers in descending order.
(d)  To check, how many times a given substring occurs in a given main

string.
(e) To find the factorial of a given number

If any one have this do send it to me

Regards,
Jogesh Kanojia,
Sr. Software Engineer.

Ease up on him guys, he's a "Senior Software Engineer", asking for help with shell scripts, what a Joke! And, as John says above on a "C programming" list!

I'd be too damn embarrassed to call myself that, and ask the community for help on the wrong list Yet!

Jim Boedicker
(Already Did My Homework!)

Signature · 2 lines
"Besides, I think Slackware sounds better than "Microsoft", don't you?
                    -Patrick Volkerding
#5 lore raw

Re: Help in Shell script

In reply to Jogesh Kanojia

On Tue, 2004-05-11 10:05:43 +0530, Jogesh Kanojia <[email protected]> wrote in message <[email protected]>:

Quoted 4 lines

Hi

I want shell programs for the following:
(a) To find the smallest number among the 3 numbers given.

function get_smallest_3() {
	[ "$1" -lt "$2" -a "$1" -lt "$3" ] && echo "$1"
	[ "$2" -lt "$1" -a "$2" -lt "$3" ] && echo "$2"
	[ "$3" -lt "$1" -a "$3" -lt "$2" ] && echo "$2"
}
Quoted 1 line

(b) To check whether the given string is a palindrome or not.

function is_palindrome() {
	if [ "$1" = "`echo "$1" | rev`" ]; then
		return 0
	else
		return 1
	fi
}
Quoted 1 line

(c) To sort the given list of numbers in descending order.

function sort_numbers() {
	for nr in $*; do
		echo $nr
	done | sort --numeric-sort --reverse
}
Quoted 2 lines

(d) To check, how many times a given substring occurs in a given main string.

That seems to be a bit more complicated. Don't have an idea ad hoc...

Quoted 1 line

(e) To find the factorial of a given number

function factorial() {
	echo -e "define fact(x) { if (x <= 1) return (1); return (fact(x-1) * x); }\nfact(4)" | bc
}

Of course, there are superb books on shell programming and yes, I don't like preparing other people's homework:)

MfG, JBG

Signature · 4 lines
   Jan-Benedict Glaw       [email protected]    . +49-172-7608481
   "Eine Freie Meinung in  einem Freien Kopf    | Gegen Zensur | Gegen Krieg
    fuer einen Freien Staat voll Freier Bürger" | im Internet! |   im Irak!
   ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));