homework

Is it possible to simplify this regular expression any further?

I'm working on some homework for my compiler class and I have the following problem: Write a regular expression for all strings of a's and b's that contain an odd number of a's or an odd number of b's (or both). After a lot of whiteboard work I came up with the following solution: (aa|bb)* (ab|ba|a|b) ((aa|bb)* (ab|ba) (aa|bb)* (ab|ba...

Visual Studio 2008 and Visual studio 2005

I am developing a Windows Application using the .net Framework 2.0 and Visual C#(Microsoft Visual Studio 2008) in my PC. On the completion of my project I have to execute it in a system which has Visual Studio 2005 and .net framework 2.0. So my doubt is if I develop an application in Microsoft Visual Studio 2008 will I be able to execu...

What are the differences between if, else, and else if?

I am trying to discern the difference between if else else if When do you use them and when not? I have a homework assignment with a ton of instances and I am running into code error due to not knowing the differences between each. Can someone please define how to use these? ...

Max DateTime in a Loop

How do you get the max datetime from a list of DateTime values using C#2.0? ...

Count number of nodes in a linked list that may be circular

Here is the problem, it is from Sedgwick's excellent Algorithms in Java (q 3.54) Given a link to a node in a singly linked list that contains no null links (i.e. each node either links to itself or another node in the list) determine the number of different nodes without modifying any of the nodes and using no more than constant memory ...

Handling input into struct elements with array

I'm doing an assignment that involves structs. You are to make a struct with three variables and declare 3 instances of that struct. The program will then ask for the user to input 9 pieces of information. I don't like having to type cout and cin unnecessarily (9 sequential times?), so I was thinking I could use loops to handle the inpu...

Graph Theory Question

This is a two part question. In a reunion of 20 people, there are 48 pairs of people that know each other. a) Justify why there is, at least, one person who knows, at most, other 4 persons. b) Suppose there is a single person who knows at most other 4 persons. How many people does that person knows exactly? I'm unsure about my answe...

How to understand complicated function declarations?

How to understand following complicated declarations? char (*(*f())[])(); char (*(*X[3])())[5]; void (*f)(int,void (*)()); char far *far *ptr; typedef void (*pfun)(int,float); int **(*f)(int**,int**(*)(int **,int **)); EDIT : After people have cursed me, I am tagging this as homework question. :-) ...

How do I use NSTimer

Hey all, How do I use an NSTimer. Can anyone give me step by step instructions? Thanks, Kevin ...

List of all months and year between two dates in PHP

Hi everybody, i need a help. I am explaining at details so that easy to understand. I want a list of month and year based on the difference of month and year. I am implementing search functionality based on Start month with year and end month with year. So start Selection - 01(month)-2009 (Yr) End selection 10(month)-2009 (Yr) so i ...

Qsort based on a column in a c-string?

A class project involves sorting an array of strings, with each string containing an equal number of columns like this: Cartwright Wendy 93 Williamson Mark 81 Thompson Mark 100 Anderson John 76 Turner Dennis 56 The program accepts a command-line argument for which column to sort on, and should print ou...

Heap Corruption, Possible Memory Leaks, C++

I have a homework assignment that I've nearly completed. As inefficient as it is be I was just wanting to know how I can prevent a crash when my program ends. quack::quack(int capacity) : backPtr( NULL ), frontPtr( NULL ) { items = new item[capacity]; backPtr = new item; frontPtr = new item; midPtr = new item; cu...

MIPS: How do parse out digits of a number? Basic question but yet hard.

I am currently learing MIPS for a class and wrote the below sample code. # UNTITLED PROGRAM .data # Data declaration section .text main: # Start of code section li $t1, 72 move $a0, $t1 li $v0,1 exit: li $v0, 10 syscall # END OF PROGRAM As show...

C++ `argc` and `argv` arguments

Can anyone explain what are and how to use "argc" and "argv"? It seems my new assignment is about "argc" and "argv", but I don't know what they are. -- thanks guys but i still dont understand what's what. these are codes from my revision notes, anyone can explain which is which that has been explained below? class Tank{ public; int...

How to use `grep` as to choose lines with column > 1?

I get results like below from a pipeline in linux: 1 test1 1 test2 2 test3 1 test4 3 test5 1 test6 1 test7 How can I use grep to retrieve only the lines where the first column is > 1? ...

Creating an array of zero width and zero height!?

I have an assignment from my programming class, which is very poorly worded... The following line really stumps me. We're creating a class called FloatArray, which contains an array (arr, which is just a pointer to a bunch of floats). The default constructor FloatArray(); should create array of zero width and zero height. I have ...

Java XML Parsing

I could use some guidance on the following problem. The whole "No use of XML libraries is allowed" part is throwing me for a loop. Thanks! Create a java program that takes XML as input, parses the input and writes all the element names to the console indented with tabs to their nesting level. You should handle xml attributes, but you d...

Python - Writing pseudocode?

How would you write pseudocode for drawing an 8-by-8 checkerboard of squares, where none of the squares have to be full? (Can all be empty) I don't quite get the pseudocode concept. ...

Shifting A Circular Array

I have a homework assignment that requires having to shift a circular array -n places in memory. I have accomplished the task with the following C++ Syntax: while ( r < 0 ) // rotate negatively. { if ( i == top+1 ) { current->n = items[top+1].n; items[top+1].n = items[back-1].n; } midPtr->n = items[+...

Unable to compute product, quotient, and difference in java

I'm trying to computing a few things in a simple java application for school. A user must into 2 integers and once you input those variables in it will spit out the sum, product, quotient and difference. I am only able to get the program to spit out sum but not product, quotient and difference. any suggestions? here is my code: // This ...