Questions
how to implement h / k sqrt(n) in c h being a constant k being the...

how to implement h / k sqrt(n) in c
h being a constant
k being the students k(k < 10^9)
n is the two mid points in a ternary search

in c programing

In: Computer Science

Many professors have a policy that punishes individuals if the don’t come to class. Instead of...

Many professors have a policy that punishes individuals if the don’t come to class. Instead of punishing students who do not attend class, what could professors do to provide a positive incentive to come to class?

In: Psychology

The database design process for noSQL databases is different from one for relational (SQL) databases. As...

The database design process for noSQL databases is different from one for relational (SQL) databases.

As we learned noSQL database does not require to have a predefined structure, except of creating a list of databases and the list of collections. Some of the noSQL databases (like MongoDB) allow to define certain rules that will define what should be the structure of the acceptable documents for each collection.

As you may recall, when you need to store multiple data points in a relational database you use multiple records (rows) where each record and then values to describe properties of that record will be placed in the columns. Unlike relational databases, noSQL databases allow two ways of storing multiple values (lists):

  • By creating multiple documents (one per record);
  • By creating lists within a single document.

The choice between one or another is based on the potential size of the list, size of the records, and the most common operations the database will need to process. The rule of thumb will be if the list changes regularly and each item in the list or complex (an object itself), not very well connected to the other items, or the list is very long, then use one document per record approach. Note, that the size of the document may also be limited (e.g. 15MB for a MongoDB document).

If the list is small, it has with small records, and unlikely change often, then you can make it as a part of one document.

For example, if you have a database of the business transactions, and there could be millions of those transactions recorded per minute, create a new document for each of them with me more efficient choice. In contrary, when you store information about degrees that an employee earned, which will be updated rarely, all degrees can be combined into a list in one employee profile document.

MongoDB also allows to use relational database – like relations, by using a document id as a value in another document.

You may read more about best practices of MongoDB design (Links to an external site.).

Business Case

A car-sharing company decided to use a MongoDB noSQL database to store information about their primary operations, which include recording of all rides, real time car locations, and users. A ride defined as combination of pick-up location, drop-off locations (if the car has been returned), with the associated timestamps of the those events.

Directions

In this assignment, you will propose a database structure for the given business case. It should include the list of collections, and one sample document (in JSON format) for each collection to demonstrate the document structure.

Put the list of the collections with the comments on their role along with the sample documents in JSON format in a single .txt file and submit it.

In: Computer Science

Acct 510 - MN CAFR Independent Assignment Page 1 Chapter 18 Lab => Government Accounting -...

Acct 510 - MN CAFR Independent Assignment Page 1

Chapter 18 Lab => Government Accounting - MN Comprehensive Annual

Financial Report (CAFR)

Note: The MN CAFR is available online in the state of MN website (www.finance.state.mn.us).

NOTE: If you are not sure if you are interpreting a question correctly…just note your assumption.

Introduction Section

Transmittal Letter

1. What basis of accounting is this system maintained?

State Principal Officials

1. List the following:

a. Governor –

b. Attorney General –

c. State Auditor –

d. Chief Justice of the MN Supreme Court -

Financial Section

Management Discussion and Analysis (MD&A)

1. List the government wide financial statements.

2. List the three types of government activities broken down in the government wide financial

statements.

3. What type of activity would Metropolitan State University considered?

4. List the state’s top three component units.

5. The state’s funds are separated into three types of funds;

a. List the three fund types.

b. What fund is Metropolitan State University a part?

6. Explain in your own words the difference between Budgetary Basis vs. GAAP?

Basic Financial Statements

1. What % of Total Assets do Cash and Cash Equivalents (unrestricted) represent?

2. Why would the state of MN carry such a high % of cash and cash equivalents?

3. What is the amount of General Obligation Bonds Payable?

Acct 510 - MN CAFR Independent Assignment Page 2

a. Current

b. Noncurrent

c. Total

4. In descending order, list the five largest “General Revenue” sources and the dollar amounts

(exclude “Other Taxes” from your list). Hint: All are found in the tax section.

5. What is the difference between Program Revenues and General Revenues?

6. List the three largest net expenditures for the state; in the following format.

Description Expense Revenue Total Net Expenditure

1st

2nd

3rd

7. Compare Net Assets of Governmental Activities to the Total Fund Balance for Governmental

Funds.

a. What is the total difference?

b. List the largest asset and the largest liability driving this difference. Why do these

differences exist? Be specific (provide examples) in your explanation for the

difference.

c. Explain in your own words why there is a $ revenue difference.

8. Compare the Change in Net Assets of Governmental Activities to the Net Change in Fund

Balances for Governmental Funds.

a. What is the total difference?

b. List and explain the three largest reconciling differences.

9. How does the University of Minnesota compare to the State Colleges and Universities from

a financial perspective?

In: Accounting

class LinkListTest { public static void main(String[] args) { LinkList theList = new LinkList(); theList.insertFirst(7); theList.insertFirst(6);...

class LinkListTest
{
    public static void main(String[] args)
    {
        LinkList theList = new LinkList();
        theList.insertFirst(7);
        theList.insertFirst(6);
        theList.insertFirst(5);
        theList.insertFirst(4);
        theList.insertFirst(3);
        theList.insertFirst(2);
        theList.insertFirst(1);

        theList.displayList();
        System.out.println("delete(4)");
        theList.delete(4);

        System.out.println("delete(16)");
        theList.delete(16);

        theList.displayList(); 

        System.out.println("insertAfter(2, 12)");
        theList.insertAfter(2, 12);

        System.out.println("insertAfter(4, 14)");
        theList.insertAfter(4, 14);

        System.out.println("insertAfter(7, 17)");
        theList.insertAfter(7, 17);

        theList.displayList();

        System.out.println("insertLast(20)");
        theList.insertLast(20);

        theList.displayList();

    } 
} 
class Link
{
    public int iData;              // data item
    public Link next;              // next link in list
    // -------------------------------------------------------------
    public Link(int id)             // constructor
    {
        iData = id;                 // initialize data
        next = null;
    }                           
    // -------------------------------------------------------------
    public void displayLink()      // display ourself
    {
        System.out.print(iData +" ");
    }
}  // end class Link
public class LinkList
{
    private Link first;            // ref to first item on list
    // -------------------------------------------------------------
    public LinkList()              // constructor
    { 
        first = null; 
    }           // no items on list yet
    // -------------------------------------------------------------
    public boolean isEmpty()       // true if list is empty
    { 
        return (first==null); 
    }
    // -------------------------------------------------------------
    public void insertFirst(int dd) // insert at start of list
    {                           // make new link
        Link newLink = new Link(dd);
        newLink.next = first;       // newLink --> old first
        first = newLink;            // first --> newLink
    }
    // -------------------------------------------------------------
    public Link deleteFirst()      // delete first item
    {                           // (assumes list not empty)
        Link temp = first;          // save reference to link
        first = first.next;         // delete it: first-->old next
        return temp;          // return deleted link
    }
    // -------------------------------------------------------------
    public void displayList()
    {
        Link current = first;       // start at beginning of list
        while(current != null)      // until end of list,
        {
            current.displayLink();   // print data
            current = current.next;  // move to next link
        }
        System.out.println("");
    }
    // -------------------------------------------------------------
}  // end class LinkList

For methods find and delete the return type is Link not key. The method returns a Link object.

Add these methods to the provided LinkList class:

1-     Key find(int key) returns the link with the specified key or null if not found.

2-     void insertAfter(int afterKey, int newKey) inserts a new link with key newKey after the node with key afterKey. If the afterKey node does not exist, the method just returns. Must call method find(int key).

3-     Key delete(int key) removes and returns the Link with the specified key if the node exists, returns null otherwise.

4-     Link getLast() returns a reference to the last link in the list.

5-     void insertLast(int key) adds a new node with the specified key to the end of the list. Must call method getLAst().

Use LinkListTest.java to test your code.

In: Computer Science

/* Array List Modified from CS2 Software Design & Data Structures by Cliff Shaffer. OpenDSA */...

/*
Array List

Modified from CS2 Software Design & Data Structures by Cliff Shaffer. OpenDSA

*/
#ifndef ALIST_H_RVC
#define ALIST_H_RVC
#include "List.h"

template // Array-based list implementation

class AList : public List {

private:
   ListItemType* listArray; //Dynamic Array (pointer)
   int listSize; //Current number of list items
   int curr; //Position of current element
   int MAX_SIZE;


public:

   //Constructors

   AList() {
       MAX_SIZE = 1000; // arbitrary
       listArray = new ListItemType[MAX_SIZE];
       clear();
   } //end constructor

   // Create a new list element with maximum size "MAX_SIZE" as a parameter
   AList(int m) {
       MAX_SIZE = m;
       listArray = new ListItemType[MAX_SIZE];
       clear();
   } //end constructor

   bool isEmpty() const {
       return listSize == 0;
   }

   void clear() { // Reinitialize the list
       listSize = curr = 0; // Simply reinitialize values
   }

   // Insert "it" at current position
   // return value indicates success

   bool insert(const ListItemType& it) {
       if (listSize >= MAX_SIZE) return false;

       for (int i = listSize; i > curr; i--) //Shift elements up
           listArray[i] = listArray[i - 1]; //to make room
       listArray[curr] = it;
       listSize++; //Increment list size
       return true;
   }

   // Append "it" to list
   bool append(const ListItemType& it) {
       cout << "\n\n******* This is to be completed for the lab\n\n";
       return true;
   }

   // Remove and return the current element
   ListItemType remove() {
       if (curr == listSize) curr--;

       ListItemType it = listArray[curr]; // Copy the element
       for (int i = curr; i < listSize - 1; i++) // Shift them down
           listArray[i] = listArray[i + 1];
       listSize--; // Decrement size
       if (curr > listSize) {
           curr = listSize;
       }
       return it;
   }

   void moveToStart() { curr = 0; } // Set to front
   void moveToEnd() { curr = listSize; } // Set to end
   void prev() { if (curr != 0) curr--; } // Move left
   void next() { if (curr < listSize) curr++; } // Move right
   int length() const { return listSize; } // Return list size
   int currPos() const { return curr; } // Return current position

                                           // Set current list position to "pos"
   bool moveToPos(int pos) {
       if ((pos < 0) || (pos > listSize)) return false;
       curr = pos;
       return true;
   }

   // Return true if current position is at end of the list5
   bool isAtEnd() const { return curr == listSize; }

   // Return the current element
   ListItemType getValue() const {
       return listArray[curr];
   }

   bool find(const ListItemType& it) {
       ListItemType curr =
       cout << "\n\n******* This is to be completed for the assignment\n\n";
       return true;
   }

   bool findNext(const ListItemType& it) {
       cout << "\n\n******* This is to be completed for the assignment\n\n";
       return true;
   }

   int count(const ListItemType& it) {
       cout << "\n\n******* This is to be completed for the assignment\n\n";
       return 0;
   }

};

#endif

Write the code for the find, findNext and count method in AList.h. This is an Array based list implementation problem in ADT, where we discuss about stacks


In: Computer Science

Write the Java source code necessary to build a solution for the problem below: Create a...

Write the Java source code necessary to build a solution for the problem below:
Create a MyLinkedList class. Create methods in the class to add an item to the head, tail, or middle of a linked list; remove an item from the head, tail, or middle of a linked list; check the size of the list; and search for an element in the list.

Create a test class to use the newly created MyLinkedList class. Add the following names in to the list: James, John, Michael, Peter, Allison, Daniel, George, Simon, Jason, and Mark. Your program should allow the user to enter a name from the console, and then search to see if the name exists in the list.

*************************************************************************************************************************

Just need help creating methods to ":remove an item from the head, tail, or middle of a linked list;"

My existing code is below:

************MyLinked List class**************

public class MyLinkedList<E> {
private Node<E> head;
private Node<E> tail;

public void addAtStart(E data) {

Node<E> newNode = new Node<>(data);

if (head == null) {
head = newNode;
tail = newNode;
} else {
Node<E> temp = head;
head = newNode;
head.next = temp;
}
}

public void addAtMid(E data) {
if (head == null)
head = new Node<>(data);
else {
Node<E> newNode = new Node<>(data);
Node<E> ptr = head;
int length = 0;
while (ptr != null) {
length++;
ptr = ptr.next;
}
int count = ((length % 2) == 0) ? (length / 2) : (length + 1) / 2;
ptr = head;
while (count-- > 1)
ptr = ptr.next;
newNode.next = ptr.next;
ptr.next = newNode;
}
}

public void addAtEnd(E data) {
Node<E> newNode = new Node<>(data);
if (head == null) {
head = newNode;
tail = newNode;
} else {
tail.next = newNode;
tail = newNode;
}
}

public void display() {

Node<E> current = head;
if (head == null) {
System.out.println("List is empty");
return;
}
while (current != null) {
System.out.print(current.data + " ");
current = current.next;
}
System.out.println();
}

public boolean search(E data) {
Node<E> current = head;
int i = 1;
boolean flag = false;
if (head == null) {
System.out.println("List is empty");
} else {
while (current != null) {
if (current.data.equals(data)) {
flag = true;
break;
}
i++;
current = current.next;
}
}
if (flag)
return true;
else
return false;
}

private class Node<E> {
public E data;
public Node<E> next;
public Node(E data) {
this.data = data;
this.next = null;
}
}
}

************Testclass class****************

import java.util.Scanner;
public class Testclass {

public static void main(String[] args) {

MyLinkedList<String> names = new MyLinkedList<>();
names.addAtStart("James");
names.addAtStart("John");
names.addAtStart("Michael");
names.addAtStart("Peter");
names.addAtMid("Allison");
names.addAtMid("Daniel");
names.addAtMid("George");
names.addAtEnd("Simon");
names.addAtEnd("Jason");
names.addAtEnd("Mark");

System.out.print("Enter the name you want to search: ");
Scanner scan = new Scanner(System.in);
String name = scan.nextLine();

if (names.search(name)) {
System.out.println("Name is in list");
}
    else {
System.out.println("That name is not in list");
}
scan.close();
names.display();
}
}

In: Computer Science

List three institutional barriers that prevent ethical dilemmas from being resolved Identifies key ethical dilemmas list...

List three institutional barriers that prevent ethical dilemmas from being resolved

Identifies key ethical dilemmas list 3 approaches to assist nurses in dealing with ethical issues

what are some of the situations that can cause a nurse to feel moral distress?

Do you think it is safer for a nurse to work in a prison or a hospital and why?

In: Nursing

1)As an employee list 8 expectations you have from your employer 2)As am employer list 8...

1)As an employee list 8 expectations you have from your employer

2)As am employer list 8 expectation you would have of your employee

3)What is considered Full Time Hours in Canada and Japan?

4)What is considered Part Time Hours in Canada and Japan?

5)What would you do if you felt something was unsafe at work? 150 words

In: Economics

how do you add two matrices linked list in java? (am using linked list because 2D...

how do you add two matrices linked list in java?
(am using linked list because 2D arrays are not allowed.)
ex
[1st matrix]
1 3 2
4 2 1
3 2 4
+
[2nd matrix]
3 2 3
2 1 4
5 2 3
=
[3rd matrix]

4 5 5
6 3 5
8 4 7

In: Computer Science