homework

Find the rightmost occurence of a character in C?

Hey all, I'm trying to find the numeric position of a character or number of characters in a string. I'm able to figure out how to see where character "a" is in the string "abcd" but if I put "abcda" it only prints out 0, meaning that it counts only the first instance. I want to find the last or rightmost occurence of this string. Her...

IBasic Accumulator

I am trying to do an accumulator in IBasic for a college assignment and I have the general stuff down but I cannot get it to accumulate. The code is below. My question is how do I get it to accumulate and pass to the different module. I'm trying to calculate how many right answers the user gets. Also, i need to calculate the percentage ...

VB 2008 - Extracting data from website question

Having more problems coming up with some code for my hwk. All I've been able to do is create the form. We have to get information off of a website and load certain information back into the textboxes on our form. I need a push in the right direction if someone could help. Assignment 6 – Text Parsing Many applications require you to ex...

VHDL How to add a std_logic_vector with a std_logic singal together ?

I've got douta : in std_logic_vector (3 downto 0); doutb : in std_logic_vector (3 downto 0); c0 : in std_logic; f1 : in std_logic; f0 : in std_logic; res : out std_logic_vector (3 downto 0); Im' trying to build a simple ALU, and one of the function this ALU provide is when f1 and f0 both = 1 res = douta plus b plus c0 so ...

Using different layouts in GUIs

This is what my program should look like and I'm a bit confused on where I should use different layouts. I have a Window class which calls the Panel class and the Panel class calls the InputPanel and DisplayPanel classes. My InputPanel class calls my DetailsPanel, CrimePanel and ButtonPanel classes so they make up what is seen under th...

getpos() coding

just wanted to know how to write the getpos() command which must return an (x,y) tuple of the current position. does it start like this: def getpos(x 100, y 100) not sure need help ...

Algorithm - Searching all loops in a network topology

I am given a network defined by nodes and links. I have to search all loops in the network. No coordinates will be given for the nodes. Is there any existing algorithm or library that can do this. Or can you please give me some idea how I can approach this problem? I am programming in .NET. I draw a diagram to illustrate what I need h...

angles commands in superclass

how do you write a command that turn left or right at an angle in a superclass is it like this: def left(self): self.position += self.angle return (self.position) is it the same as the forward and back command ...

How to do operator overloading

How do I write a program to overload the + operator so that it can add two matrices? ...

Object oriented Python

i need to write code for two "robots" that will chase each other around the screen ive managed to do most of it but what i need help with is the getName() command which returns the name of the robot (as a string) which will be overridden in the subclass. can anyone help as im new to python and havnt done this before ...

Which language to use for implementing few Linux shell commands (homework) - plain C or C++?

I need to implement a few commands of Linux shell for my homework - 5 or 6 of them, including ls. Do not know much about which parameters to implement for each of commands... I planned to use C++, but when I asked my colleague for advice what language to choose - plain C or C++, he said that interpreter was not a program in traditional ...

merge heaps algorithm

is there an efficient algorithm for merging 2 max-heaps (stored as an array)? ...

Lists in scheme

Hi, I'm trying to write a function in scheme that takes a list and squares every item on the list, then returns the list in the form (list x y z). However, I'm not sure how to write a code that will do that. So far, I have (define (square=list list) (cond [(empty? list) false] [else (list (sqr (first a-list))(square-list (res...

linear towers of hanoi

I have a question on the linear Towers of Hanoi. I implemented it in C++ but am trying to do the same using the tail recursive or iterative method. I am having trouble with my algorithm. This code snippet shows transferring blocks from the middle tower to the end tower. #include <stdlib.h> #include <stdio.h> using namespace std; //i...

Estimate Power Consumption Based on Running Time Analysis / Code Size

I've developed and tested a C program on my PC and now I want to give an estimate of the power consumption required for the program to do a single run. I've analysised the running time of the application and of invidiual function calls within the application and I know the code size both in assembly lines, but also raw C lines. How woul...

Handling CGI requests in a bare-bones http server

I am writing a basic http server in C. Handling a simple static .html file is easy but I have no idea how to handle dynamic .pl .cgi file extensions. I know I will have to use exec() but how is my question? ...

Most prevalent substring of length X

Hi! I have a string s and I want to search the most prevalent substring of length X in s, overlap are admited. For example: s="aoaoa" and X=3, return "aoa" (which appear 2 times in s). Is it an algorithm that founds this substring in O(n)? ...

Breadth first search, and A* search in a graph?

I understand how to use a breadth first search and A* in a tree structure, but given the following graph, how would it be implemented? In other words, how would the search traverse the graph? S is the start state Graph Here ...

Local search algorithm, complete confusion...

In (a) and (b), assuming a 2-exchange transformation operator, connect solutions A and B, which are TSP tours in path representation, to their possible neighbors among tours C, D, E, F, G (a) A: 1 2 3 4 5 6 7 C: 1 3 5 7 2 4 6 D: 1 2 5 4 3 6 7 E: 2 3 1 7 5 4 6 F: 4 1 7 5 3 2 6 G: 1 2 3 7 6 5 4 (b) B: 1 3 2 7 5 4 6 C: 1 3 5 7 2 4 6 D: ...

Starting with Java recursion (probably an easy ? for most)

Hi I am working on the following problem: Write a recursive function that calculates the sum of the negative numbers of the array. Pass in the array {15 , -7 , -19 , 8 , 5 , -6 , -1} from the main method . The recursive function should return the result -33 . Print out this value in the main method. This program should be named Negsum....