Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8430845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:41:49+00:00 2026-06-10T05:41:49+00:00

First, here is my code for the O(n): import java.util.*; public class BigO{ public

  • 0

First, here is my code for the O(n):

import java.util.*;

public class BigO{

  public static void main(String[] args)
  {
    Scanner in = new Scanner(System.in);
    System.out.print("Enter a number: ");
    String userInput = in.nextLine();
    int mNum = Integer.parseInt(userInput);

    int y = new BigO().linear(mNum);
    System.out.println(y);
  }

 //O(n) - Linear
 public int linear(int n) {
  int sum = 0;
  for (int j = 0; j < n; j++) {
   sum++;
   System.out.print(sum + " ");
  }
  return sum;
 }

I apologize if this is a dumb question because I haven’t done big-O notation for a long time and I want to make sure, but for whatever that I have above, is it a Bottom-Up or Top-Down calculation? If it’s neither, how can I approach for either one of them (or both)? Please let me know. Thanks.

UPDATE:
Alright, nevermind, I’ve asked some of my friends who are in my class as well as the professor and he written down our problem incorrectly. He corrected it and meant to say we were suppose to use this type of O(n) time algorithm for the recursive fibonacci. Sorry about that lol.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:41:50+00:00Added an answer on June 10, 2026 at 5:41 am

    The Big O has nothing to do with top-down/bottom-up.

    • The first one refers to a way of representing an algorithms complexity and running time, depending on the size of its input.
    • The second refers to the approach taken when breaking a problem up in subproblems in order to reach a solution.

    All these are very accessible via a Google search 🙂 .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code. import java.util.Scanner; public class ORR_P02 { public static void main(String
First some code: import java.util.*; //... class TicTacToe { //... public static void main
Given the following code : import java.io.*; public class Main { public static void
here is my code... package sortarray.com; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle;
First off here is the code! <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
Here is the code: string str; cin>>str; cout<<first input:<<str<<endl; getline(cin, str); cout<<line input:<<str<<endl; The
IN my application i am using this code to Call my First Class Xib.Here
here's the main code at first I thought is was the message box but
So, first off here's my code to open the dotx and create a new
first post here, and probably an easy one. I've got the code from Processing's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.