Sign Up

Have an account? Sign In Now

Sign In

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

Sorry, you do not have permission to ask a question, You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here
Sign InSign Up

SIKSHAPATH

SIKSHAPATH Logo SIKSHAPATH Logo

SIKSHAPATH Navigation

  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Home
  • Questions
  • Blog
    • Computer Science(CSE)
    • NPTEL
    • Startup
  • Shop
    • Internshala Answers
Home/Comments/Page 9
  1. Asked: October 23, 2022In: Data Structure

    Which algorithm is more efficient in constructing the minimum spanning …

    I'M ADMIN
    I'M ADMIN
    Added an answer on November 7, 2022 at 9:20 pm

    In Prim's, you always keep a connected component, starting with a single vertex. You look at all edges from the current component to other vertices and find the smallest among them. You then add the neighbouring vertex to the component, increasing its size by 1. In N-1 steps, every vertex would be mRead more

    In Prim’s, you always keep a connected component, starting with a single vertex. You look at all edges from the current component to other vertices and find the smallest among them. You then add the neighbouring vertex to the component, increasing its size by 1. In N-1 steps, every vertex would be merged to the current one if we have a connected graph.

    In Kruskal’s, you do not keep one connected component but a forest. At each stage, you look at the globally smallest edge that does not create a cycle in the current forest. Such an edge has to necessarily merge two trees in the current forest into one. Since you start with N single-vertex trees, in N-1 steps, they would all have merged into one if the graph was connected.

     

    Use Prim’s algorithm when you have a graph with lots of edges.

    For a graph with V vertices E edges, Kruskal’s algorithm runs in O(E log V) time and Prim’s algorithm can run in O(E + V log V) amortized time, if you use a Fibonacci Heap.

    Prim’s algorithm is significantly faster in the limit when you’ve got a really dense graph with many more edges than vertices. Kruskal performs better in typical situations (sparse graphs) because it uses simpler data structures.

    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  2. Asked: October 17, 2022In: Data Science

    Solve using fractional knapsack: M=20, n=4 P= (3, 10, 15, …

    Saurav kumar
    Saurav kumar
    Added an answer on October 17, 2022 at 6:23 pm

    M=20 (total capacity of bag) N=4 (no of items) Let’s find Pi/Wi (profit/weight) for each items: P1/W1=3/5 = 0.60 (O1) P2/W2=10/13= 0.76(O2) P3/W3= 15/12 = 1.25 (O3) P4/W4 = 5/8 = 0.62 (O4) Where O is object no   Let’s arrange them in order: 1.25 >> 0.76 >> 0.62 >> 0.60   Object takRead more

    M=20 (total capacity of bag)

    N=4 (no of items)

    Let’s find Pi/Wi (profit/weight) for each items:

    P1/W1=3/5 = 0.60 (O1)

    P2/W2=10/13= 0.76(O2)

    P3/W3= 15/12 = 1.25 (O3)

    P4/W4 = 5/8 = 0.62 (O4)

    Where O is object no

     

    Let’s arrange them in order: 1.25 >> 0.76 >> 0.62 >> 0.60

     

    Object taken

    profit

    weight

    Remaining weight

    O3

    15

    12

    8

    O2

    10

    13

    0

    O4

    5

    8

    0

    O1

    3

    5

    0

     

    Now,

    • Knapsack weight left to be filled is 8 kg but item-2 has a weight of 13 kg.
    • Since in fractional knapsack problem, even the fraction of any item can be taken.
    • So, knapsack will contain the following items-

    < O3,(8/13)O2 >

     

    See less
      • 1
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  3. Asked: October 17, 2022In: Computer Science

    When can we say that a sorting algorithm is stable …

    I'M ADMIN
    I'M ADMIN
    Added an answer on October 17, 2022 at 5:59 pm

    A sorting algorithm is In-place if the algorithm does not use extra space for manipulating the input but may require a small but nonconstant extra space for its operation. Or we can say, a sorting algorithm sorts in-place if only a constant number of elements of the input array are ever stored outsiRead more

    • A sorting algorithm is In-place if the algorithm does not use extra space for manipulating the input but may require a small but nonconstant extra space for its operation. Or we can say, a sorting algorithm sorts in-place if only a constant number of elements of the input array are ever stored outside the array.
    • A sorting algorithm is stable if it does not change the order of elements with the same value.

     

    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  4. Asked: October 17, 2022In: Computer Science

    Why dynamic approach is preferred over greedy technique?

    I'M ADMIN
    I'M ADMIN
    Added an answer on October 17, 2022 at 5:54 pm

    If we talk about Optimality: In the Greedy method approach, there is no guarantee of getting the optimal solution, Generally, it gives the optimal local solution. while In the dynamic approach, there is a guarantee of getting an optimal solution as it considers all the cases as long to get optimal.Read more

    If we talk about Optimality:

    In the Greedy method approach, there is no guarantee of getting the optimal solution, Generally, it gives the optimal local solution.

    while

    In the dynamic approach, there is a guarantee of getting an optimal solution as it considers all the cases as long to get optimal. It gives optimal global solutions.

     

    For example, let’s say that you have to get from point A to point B as fast as possible, in a given city, during rush hour. A dynamic programming algorithm will look into the entire traffic report, looking into all possible combinations of roads you might take, and will only then tell you which way is the fastest. Of course, you might have to wait for a while until the algorithm finishes, and only then can you start driving. The path you will take will be the fastest one (assuming that nothing changed in the external environment).

    On the other hand, a greedy algorithm will start you driving immediately and will pick the road that looks the fastest at every intersection. As you can imagine, this strategy might not lead to the fastest arrival time, since you might take some “easy” streets and then find yourself hopelessly stuck in a traffic jam.

     

     

     

    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  5. Asked: October 11, 2022In: Computer Science

    List down various debugging tools. Elaborate any one of them

    I'M ADMIN
    I'M ADMIN
    Added an answer on October 17, 2022 at 9:34 am

    The list of debugging tools is listed below. AppPuncher Debugger is used for debugging Rich Internet Applications AQtime debugger CA/EZ TEST is a CICS interactive test/debug software package CharmDebug is a Debugger for Charm++ CodeView debugger DBG is a PHP Debugger and Profiler dbx debugger DistriRead more

    The list of debugging tools is listed below.

    • AppPuncher Debugger is used for debugging Rich Internet Applications
    • AQtime debugger
    • CA/EZ TEST is a CICS interactive test/debug software package
    • CharmDebug is a Debugger for Charm++
    • CodeView debugger
    • DBG is a PHP Debugger and Profiler
    • dbx debugger
    • Distributed Debugging Tool (Allinea DDT)
    • DDTLite — Allinea DDTLite for Visual Studio 2008
    • DEBUG is the built-in debugger of DOS and Microsoft Windows
    • Debugger for MySQL
    • Opera Dragonfly
    • The dynamic debugging technique (DDT)
    • Embedded System Debug Plug-in is used for Eclipse
    • FusionDebug
    • Debugger OpenGL, OpenGL ES, and OpenCL Debugger and Profiler. For Windows, Linux, Mac OS X, and iPhone
    • GNU Debugger (GDB), GNU Binutils
    • Intel Debugger (IDB)
    • The system is used as circuit debugger for Embedded Systems
    • Interactive Disassembler (IDA Pro)
    • Java Platform Debugger Architecture source Java debugger
    • LLDB
    • MacsBug
    • IBM Rational Purify
    • TRACE32 is circuit debugger for Embedded Systems
    • VB Watch Debugger — debugger for Visual Basic 6.0
    • Microsoft Visual Studio Debugger
    • WinDbg
    • Xdebug — PHP debugger and profiler

     

     

    GNU Debugger

    GNU Debugger, which is also called gdb, is the most popular debugger for UNIX systems to debug C and C++ programs.

    GNU Debugger helps you in getting information about the following:

    • If a core dump happened, then what statement or expression did the program crash on?
    • If an error occurs while executing a function, what line of the program contains the call to that function, and what are the parameters?
    • What are the values of program variables at a particular point during execution of the program?
    • What is the result of a particular expression in a program?

    How GDB Debugs?

    GDB allows you to run the program up to a certain point, then stop and print out the values of certain variables at that point, or step through the program one line at a time and print out the values of each variable after executing each line.

    GDB uses a simple command line interface.

    See less
      • 0
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
  6. Asked: October 12, 2023In: Other

    Evaluating the maximum number of pages needed, if a system supports 16 bit address line and 1K page size

    I'M ADMIN
    Best Answer
    I'M ADMIN
    Added an answer on October 17, 2022 at 9:30 am
    This answer was edited.

    To evaluate the maximum number of pages required when a system supports a 16-bit address line and a 1K (1024 Bytes) page size, we can break it down as follows: 16-bit Address Line: A 16-bit address line can address up to 216 locations (bytes). Page Size: Given a page size of 1K, which is equivalentRead more

    To evaluate the maximum number of pages required when a system supports a 16-bit address line and a 1K (1024 Bytes) page size, we can break it down as follows:

    16-bit Address Line:

    • A 16-bit address line can address up to 216 locations (bytes).

    Page Size:

    • Given a page size of 1K, which is equivalent to 1024 Bytes (Ref: 1 KB = 1024 Bytes).

    Now, calculate the maximum number of pages needed:

    Total Addressable Locations= 216= 65536 locations.

    Page Size = 1024 Bytes.

    To find the total number of pages, divide the total addressable locations by the page size:

    Total Pages= Total Addressable Locations/Page Size= 65536/1024= 64 pages.

    Hence, in a system with a 16-bit address line and a 1K page size, the maximum number of pages required is 64.

    See less
      • 2
    • Share
      Share
      • Share on WhatsApp
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
1 … 7 8 9 10 11 … 194

Sidebar

store ads

Stats

  • Questions 1k
  • Answers 1k
  • Posts 149
  • Best Answers 89
  • This Free AI Tool Translates Entire Books in Minute !
  • AI News: 🎬 Hollywood’s AI Studios, 🎓 OpenAI’s Latest Gift to Educators, 🚚 Class8 Bags $22M, 🧠 Google Gemini’s Memory Upgrade
  • AI NEWS: Legal Action Against OpenAI, $16M Paid, & Elon Musk’s Praise from Investor 🤖💰📑 | AI Boosts Cloud Seeding for Water Security 🌱💧
  • AI News: 🎬AI Video Tool Scam Exposed🤯, 🛰️ AI-Powered Drones to Ukraine 😱, Google’s $20M AI Push, Sam Altman Joins SF’s Leadership Team
  • AI News: 🤝 Biden Meets Xi on AI Talks, 💡 Xavier Niel’s Advice for Europe, ♻️ Hong Kong’s Smart Bin Revolution, 🚀 AI x Huawei

Explore

  • Recent Questions
  • Questions For You
  • Answers With Time
  • Most Visited
  • New Questions
  • Recent Questions With Time

Footer

SIKSHAPATH

Helpful Links

  • Contact
  • Disclaimer
  • Privacy Policy Notice
  • TERMS OF USE
  • FAQs
  • Refund/Cancellation Policy
  • Delivery Policy for Sikshapath

Follow Us

© 2021-24 Sikshapath. All Rights Reserved