Search Results

Search found 1102 results on 45 pages for 'recurrence relation'.

Page 1/45 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Finding recurrence relations of an algorithm

    - by Roarke
    I'm reading my algorithms text book, and I'm reading about recurrence relations and finding the algorithms big O complexity. I run across this line "In the case of the merge-sort algorithm, we get the recurrence equation: t(n) = b if n < 2 = 2t(n/2) +bn if n >= 2 for b > 0 my response was "how the heck did we know that?!?!" So i'm wondering if there is a systematic approach, or just a logical way of getting these recurrence relations from the algorithms can some one explain where the b and the two 2's come from?

    Read the article

  • Recurrence relation solution

    - by Travis
    I'm revising past midterms for a final exam this week and am trying to make sense of a solution my professor posted for one of past exams. (You can see the original pdf here, question #6). I'm given the original recurrence relation T(m)=3T(n/2) + n and am told T(1) = 1. I'm pretty sure the solution I've been given is wrong in a few places. The solution is as follows: Let n=2^m T(2^m) = 3T(2^(m-1)) + 2^m 3T(2^(m-1)) = 3^2*T(2^(m-2)) + 2^(m-1)*3 ... 3^(m-1)T(2) = T(1) + 2*3^(m-1) I'm pretty sure this last line is incorrect and they forgot to multiply T(1) by 3^m. He then (tries to) sum the expressions: T(2^m) = 1 + (2^m + 2^(m-1)*3 + ... + 2*3(m-1)) = 1 + 2^m(1 + (3/2)^1 + (3/2)^2 + ... + (3/2)^(m-1)) = 1 + 2^m((3/2)^m-1)*(1/2) = 1 + 3^m - 2^(m-1) = 1 + n^log 3 - n/2 Thus the algorithm is big Theta of (n^log 3). I'm pretty sure that he also got the summation wrong here. By my calculations this should be as follows: T(2^m) = 2^m + 3 * 2^(m-1) + 3^2 * 2^(m-2) + ... + 3^m (3^m because 3^m*T(1) = 3^m should be added, not 1) = 2^m * ((3/2)^1 + (3/2)^2 + ... + (3/2)^m) = 2^m * sum of (3/2)^i from i=0 to m = 2^m * ((3/2)^(m+1) - 1)/(3/2 - 1) = 2^m * ((3/2)^(m+1) - 1)/(1/2) = 2^(m+1) * 3^(m+1)/2^(m+1) - 2^(m+1) = 3^(m+1) - 2 * 2^m Replacing n = 2^m, and from that m = log n T(n) = 3*3^(log n) - 2*n n is O(3^log n), thus the runtime is big Theta of (3^log n) Does this seem right? Thanks for your help!

    Read the article

  • C#: Recurrence Calandar issue of Lotus notes

    - by Royson
    Hi all, I am creating a Recurrence pattern in calendar items. But there is a issue as before clicking "Save and Send Invitations" button of Lotus notes 8.5, i am able to view the "RepeatForUnit" field from document property and based on its value i am identifying the Recurrence type like (D: for daily, W: for Weekly, M: for monthly etc). But, After clicking on the "Save and Send Invitations" button, the Recurrence is getting saved but after that, i am unable to get the "RepeatForUnit" field in Document Properties. Kindly help me, how to identify the Recurrence type and the related fields. Note: I am using Domino.dll using C#.

    Read the article

  • recurrence maths

    - by Tony
    Hi all! I have the following: T(n) <= c floor(n/2) + c ceiling(n/2) + 1 = cn + 1 T(n) = O(n) I don't understand how it gets from the first equation to the second equation? What part of the maths am I missing to understand how this comes to be? Is it done using 'Simplifying Equations' or some other rules? Can someone help me?

    Read the article

  • Linear Recurrence for very large n

    - by Android Decoded
    I was trying to solve this problem on SPOJ (http://www.spoj.pl/problems/REC/) F(n) = a*F(n-1) + b where we have to find F(n) Mod (m) where 0 <= a, b, n <= 10^100 1 <= M <= 100000 I am trying to solve it with BigInteger in JAVA but if I run a loop from 0 to n its getting TLE. How could I solve this problem? Can anyone give some hint? Don't post the solution. I want hint on how to solve it efficiently.

    Read the article

  • Starter question of declarative style SQLAlchemy relation()

    - by jfding
    I am quite new to SQLAlchemy, or even database programming, maybe my question is too simple. Now I have two class/table: class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String(40)) ... class Computer(Base): __tablename__ = 'comps' id = Column(Integer, primary_key=True) buyer_id = Column(None, ForeignKey('users.id')) user_id = Column(None, ForeignKey('users.id')) buyer = relation(User, backref=backref('buys', order_by=id)) user = relation(User, backref=backref('usings', order_by=id)) Of course, it cannot run. This is the backtrace: File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/state.py", line 71, in initialize_instance fn(self, instance, args, kwargs) File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/mapper.py", line 1829, in _event_on_init instrumenting_mapper.compile() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/mapper.py", line 687, in compile mapper._post_configure_properties() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/mapper.py", line 716, in _post_configure_properties prop.init() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/interfaces.py", line 408, in init self.do_init() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/properties.py", line 716, in do_init self._determine_joins() File "/Library/Python/2.6/site-packages/SQLAlchemy-0.5.8-py2.6.egg/sqlalchemy/orm/properties.py", line 806, in _determine_joins "many-to-many relation, 'secondaryjoin' is needed as well." % (self)) sqlalchemy.exc.ArgumentError: Could not determine join condition between parent/child tables on relation Package.maintainer. Specify a 'primaryjoin' expression. If this is a many-to-many relation, 'secondaryjoin' is needed as well. There's two foreign keys in class Computer, so the relation() callings cannot determine which one should be used. I think I must use extra arguments to specify it, right? And howto? Thanks

    Read the article

  • Django Querying Relation of Relation

    - by Brent
    I'm stuck on a Django ORM issue that is bugging me. I have a set of models linked by a foreign key but the requirements are a bit odd. I need to list items by their relation's relation. This is hard to explain so I've tried to depict this below, given: Work ManyToMany(Award) Award ForeignKey(AwardCategory) AwardCategory I need to list work items so they are listed by the award category. Desired output would be: Work Instance A Award Instance A that belongs to Award Category Instance A Award Instance C that belongs to Award Category Instance A Award Instance G that belongs to Award Category Instance A Work Instance A (same instance as above, but listed by different award__category) Award Instance F that belongs to Award Category Instance B Award Instance R that belongs to Award Category Instance B Award Instance Z that belongs to Award Category Instance B Work Instance B Award Instance B that belongs to Award Category Instance A Award Instance A that belongs to Award Category Instance A Essentially I want to list all work by the award category. I can get this to work in part but my solution is filthy and gross. I'm wondering if there is a better way. I considered using a ManyToMany and a through attribute but I'm not certain if I'm utilizing it correctly.

    Read the article

  • sqlalchemy relation through another (declarative)

    - by clayg
    Is anyone familiar with ActiveRecord's "has_many :through" relations for models? I'm not really a Rails guy, but that's basically what I'm trying to do. As a contrived example consider Projects, Programmers, and Assignments: from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from sqlalchemy import Column, ForeignKey from sqlalchemy.types import Integer, String, Text from sqlalchemy.orm import relation from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class Assignment(Base): __tablename__ = 'assignment' id = Column(Integer, primary_key=True) description = Column(Text) programmer_id = Column(Integer, ForeignKey('programmer.id')) project_id = Column(Integer, ForeignKey('project.id')) def __init__(self, description=description): self.description = description def __repr__(self): return '<Assignment("%s")>' % self.description class Programmer(Base): __tablename__ = 'programmer' id = Column(Integer, primary_key=True) name = Column(String(64)) assignments = relation("Assignment", backref='programmer') def __init__(self, name=name): self.name = name def __repr__(self): return '<Programmer("%s")>' % self.name class Project(Base): __tablename__ = 'project' id = Column(Integer, primary_key=True) name = Column(String(64)) description = Column(Text) assignments = relation("Assignment", backref='project') def __init__(self, name=name, description=description): self.name = name self.description = description def __repr__(self): return '<Project("%s", "%s...")>' % (self.name, self.description[:10]) engine = create_engine('sqlite://') Base.metadata.create_all(engine) Session = sessionmaker(bind=engine) session = Session() Projects have many Assignments. Programmers have many Assignments. (understatement?) But in my office at least, Programmers also have many Projects - I'd like this relationship to be inferred through the Assignments assigned to the Programmer. I'd like the Programmer model to have a attribute "projects" which will return a list of Projects associated to the Programmer through the Assignment model. me = session.query(Programmer).filter_by(name='clay').one() projects = session.query(Project).\ join(Project.assignments).\ join(Assignment.programmer).\ filter(Programmer.id==me.id).all() How can I describe this relationship clearly and simply using the sqlalchemy declarative syntax? Thanks!

    Read the article

  • How to specify an association relation using declarative base

    - by sam
    I have been trying to create an association relation between two tables, intake and module . Each intake has a one-to-many relationship with the modules. However there is a coursework assigned to each module, and each coursework has a duedate which is unique to each intake. I tried this but it didnt work: intake_modules_table = Table('tg_intakemodules',metadata, Column('intake_id',Integer,ForeignKey('tg_intake.intake_id', onupdate="CASCADE",ondelete="CASCADE")), Column('module_id',Integer,ForeignKey('tg_module.module_id', onupdate ="CASCADE",ondelete="CASCADE")), Column('dueddate', Unicode(16)) ) class Intake(DeclarativeBase): __tablename__ = 'tg_intake' #{ Columns intake_id = Column(Integer, autoincrement=True, primary_key=True) code = Column(Unicode(16)) commencement = Column(DateTime) completion = Column(DateTime) #{ Special methods def __repr__(self): return '"%s"' %self.code def __unicode__(self): return self.code #} class Module(DeclarativeBase): __tablename__ ='tg_module' #{ Columns module_id = Column(Integer, autoincrement=True, primary_key=True) code = Column(Unicode(16)) title = Column(Unicode(30)) #{ relations intakes = relation('Intake', secondary=intake_modules_table, backref='modules') #{ Special methods def __repr__(self): return '"%s"'%self.title def __unicode__(self): return '"%s"'%self.title #} When I do this the column duedate specified in the intake_module_table is not created. Please some help will be appreciated here. thanks in advance

    Read the article

  • rails 3.0.3 - ActiveRecord::Relation, undefined method error

    - by brg
    I am having this unexplained ActiveRecord::Relation, undefined method error . I don't know why, since my model association are well defined and the event table has the foreign keys for the user table. I tried using this fix but it failed: Rails 3 ActiveRecord::Relation random associations behavior event.rb class Event < ActiveRecord::Base belongs_to :user attr_accessible :event_name, :Starts_at, :finish, :tracks end user.rb class User < ActiveRecord::Base has_many :events, :dependent = :destroy attr_accessible :name, :event_attributes accepts_nested_attributes_for :events, :allow_destroy = true end schema.rb ActiveRecord::Schema.define(:version = 20101201180355) do create_table "events", :force = true do |t| t.string "event_name" t.string "tracks" t.datetime "starts_at" t.datetime "finish" t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" end end error message NoMethodError in Users#index undefined method `events' for # Extracted source (around line #10): 7: <%= sortable "Tracks" % 8: 10: <% @users.events.each do |event| % 11: <% debugger % 12: 13: <%= event.starts_at % Trace of template inclusion: app/views/users/index.html.erb Rails.root: C:/rails_project1/events_manager Application Trace | Framework Trace | Full Trace app/views/users/_event_user.html.erb:10:in _app_views_users__event_user_html_erb__412443848_34308540_1390678' app/views/users/index.html.erb:7:in_app_views_users_index_html_erb___603337143_34316016_0'

    Read the article

  • JPA map relation entity parentID...

    - by Fabio Beoni
    Hello, could someone help me to understand how can I define an entity with JPA mapping that has a relation with it self? For example, my entity is CompanyDivision, divisionA contains divisionB, divisionC and divisionB contains divisionB1, divisionB2 divisionA divisionB divisionB1 divisionB2 divisionC Thank you!

    Read the article

  • Doctrine generate models - problem with relation type

    - by mrok
    I am trying generate doctrine models from yaml schema I have schema like that: Product: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true activation_time: type: datetime notnull: true enduser_id: type: integer(5) unsigned: true notnull: true relations: Enduser: foreignType: one type: one foreignAlias: Product Hostid: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true value: type: string(32) fixed: true notnull: true Order: columns: id: type: integer(5) primary: true autoincrement: true unsigned: true expire_date: type: datetime description: type: clob Enduser: columns: id: type: integer(5) primary: true unsigned: true autoincrement: true hostid_id: type: integer(5) unsigned: true notnull: true order_id: type: integer(5) unsigned: true notnull: true relations: Order: foreignAlias: Endusers Hostid: foreignAlias: Endusers and the problem is that models generated by doctrine generate-models-yaml are wrong in BaseEnduser $Product is defined as Doctrine_Collection $this-hasMany('Product', array( 'local' = 'id', 'foreign' = 'enduser_id')); instead just Product object what did I wrong? relation is defined as foreignType: one type: one

    Read the article

  • undefined method `events' for #<ActiveRecord::Relation:0x4177518> -rails 3.0.3

    - by brg
    I am having this unexplained NoMethodError with undefined method `events' for #. I don't know why since my model association are well defined and the event table has the foreign keys for the user table. I tried using this fix but it failed: Rails 3 ActiveRecord::Relation random associations behavior event.rb class Event < ActiveRecord::Base belongs_to :user attr_accessible :event_name, :Starts_at, :finish, :tracks end user.rb class User < ActiveRecord::Base has_many :events, :dependent = :destroy attr_accessible :name, :event_attributes accepts_nested_attributes_for :events, :allow_destroy = true end schema.rb ActiveRecord::Schema.define(:version = 20101201180355) do create_table "events", :force = true do |t| t.string "event_name" t.string "tracks" t.datetime "starts_at" t.datetime "finish" t.datetime "created_at" t.datetime "updated_at" t.integer "user_id" end end error message NoMethodError in Users#index undefined method `events' for # Extracted source (around line #10): 7: <%= sortable "Tracks" % 8: 10: <% @users.events.each do |event| % 11: <% debugger % 12: 13: <%= event.starts_at % Trace of template inclusion: app/views/users/index.html.erb Rails.root: C:/rails_project1/events_manager Application Trace | Framework Trace | Full Trace app/views/users/_event_user.html.erb:10:in _app_views_users__event_user_html_erb__412443848_34308540_1390678' app/views/users/index.html.erb:7:in_app_views_users_index_html_erb___603337143_34316016_0'

    Read the article

  • What exactly are Link Relation Values?

    - by bckpwrld
    From REST in Practice: Hypermedia and Systems Architecture: For computer-to-computer interactions, we advertise protocol information by embedding links in representations, much as we do with the human Web. To describe a link's purpose, we annotate it. Annotations indicate what the linked resource means to the current resource: “status of your coffee order” “payment” and so on. We call such annotated links hypermedia controls, reflecting their enhanced capabilities over raw URIs. ... link relation values, which describe the roles of linked resources ... Link relation values help consumers understand why they might want to activate a hypermedia control. They do so by indicating the role of the linked resource in the context of the current representation. I interpret the above quotes as saying that Hypermedia control contains both a link to a resource and an annotation describing the role of linked resource in the context of the current representation. And we call this annotation ( which describes the role of linked resource ) a link relation value. Is my assumption correct or does the term link relation value actually describe something different? Thank you

    Read the article

  • Solving a recurrence T(n) = 2T(n/2) + n^4

    - by user563454
    I am studying using the MIT Courseware and the CLRS book Introduction to Algorithms. Solving recurrence T(n) = 2T(n/2) + n4 (page 107) If I make a recurrence tree I get: level 0 n^4 level 1 2(n/2)^4 level 2 4(n/4)^4 level 3 8(n/8)^4 The tree has lg(n) levels. Therefore the recurrence is T(n) = Theta(lg(n)n^4)) But, If I use the Master method I get. Apply case 3: T(n) = Theta(n^4) If I apply the substitution method both seem to hold. Which one is ri?

    Read the article

  • Salon du E-commerce et Social CRM B2B

    - by Valérie De Montvallon
    Nous participions au Salon du E-commerce et Social CRM B2B en septembre dernier et nous vous proposons la vidéo réalisée par Les décideurs de la relation client. Découvrez des avis d'experts de la Relation Client pour en savoir toujours plus sur le Social CRM BtoB. Pour le BtoB, la gestion de la Relation Client semble bien simple quand il s’agit de récolter des informations à partir d’appels téléphoniques, d’entretiens physiques ou d’emails. Toutefois, la tâche s’enhardit sur les réseaux sociaux. Ces plateformes sont-elles réellement adaptées au BtoB ? Comment procéder quand on se lance ? Quels sont les pièges à éviter ? Quels sont les éléments qui laissent à penser que le Social CRM BtoB est une vraie tendance de la Relation Client ? Autant de questions auxquelles les experts rencontrés ont apporté des éléments de réponse. Vous découvrirez l'interview de notre expert, Khalid Madarbokus, qui s'exprime sur la remontée d'informations depuis les médias sociaux au sein des départements d'une entreprise B2B (à 3:20)

    Read the article

  • juju: How do I list all the relation variables and debug them interactively?

    - by mfisch
    I'm writing a charm that requires a mysql database, I found from looking at other charms that this (below) is how I get the info about the database: user=`relation-get user` password=`relation-get password` mysqlhost=`relation-get private-address` But I just found that from reading the wordpress charm example, is there a way to show all the relation variables that I can use? Also, while debugging my db-relation-changed script, I wanted to ssh into my host and interactively run those commands, for example relation-get user, but it didn't work. I resorted to having to restart everything and use juju log to print them out. This wasted a lot of time. Is there a way to print out these relations, either from my dev box or from the instance running my charm? (Below is what happens when I tried to interactively run relation-get): ubuntu@mfisch-local-tracks-0:~$ relation-get user usage: relation-get [-h] [-o OUTPUT] [-s SOCKET] [--client-id CLIENT_ID] [--format FORMAT] [--log-file FILE] [--log-level CRITICAL|DEBUG|INFO|ERROR|WARNING] [-r RELATION ID] [settings_name] [unit_name] No JUJU_AGENT_SOCKET/-s option found

    Read the article

  • Juju MySQL adding units vs adding new service with relation

    - by user2291975
    What's the point of adding units to MySQL? Why not just create a new service with relation to the master node? MySQL doesn't support multi-master node so adding units to one MySQL service doesn't make any sense. If I create a second service as a slave and add units to that to act as multiple slaves still doesn't make sense because if the primary slave server dies all the unites attached to it become useless as well. Can anyone explain why I should add units to MySQL?

    Read the article

  • seo in relation to web-hosting [closed]

    - by jimmy obonyo
    Possible Duplicate: Does changing web hosting server affects SEO page ranking? I have two websites.one of the site though vigorous attempts to search optimize to certain google keywords or even the site name still performs poorly,while the other site does actually perform better and better.the two sites are hosted by different hosting companies...one bytehost.net the other by youhosting.com.So here is my question,does anyone know if there any relation of hosting company with indexing or not, and if there is a relationship how to choose a good company to get better seo indexing ,rating

    Read the article

  • Looking for terminology for the relation of a subject and a predicate

    - by kostja
    While writing some predicates for collection filtering I have stumbled over the choice of the right words for the relation of the subject and the predicate (English is a foreign language for me). What I ended up writing was "Subjects matching this predicate..." This seems to be incorrect, since predicates are functions and not regular expressions. But saying "Subjects for which this predicate returns true..." sounds awkward to me as well.. So what would be the correct term?

    Read the article

  • How do I list all the relation variables and debug them interactively?

    - by mfisch
    I'm writing a charm that requires a mysql database, I found from looking at other charms that this (below) is how I get the info about the database: user=`relation-get user` password=`relation-get password` mysqlhost=`relation-get private-address` But I just found that from reading the wordpress charm example, is there a way to show all the relation variables that I can use? Also, while debugging my db-relation-changed script, I wanted to ssh into my host and interactively run those commands, for example relation-get user, but it didn't work. I resorted to having to restart everything and use juju log to print them out. This wasted a lot of time. Is there a way to print out these relations, either from my dev box or from the instance running my charm? (Below is what happens when I tried to interactively run relation-get): ubuntu@mfisch-local-tracks-0:~$ relation-get user usage: relation-get [-h] [-o OUTPUT] [-s SOCKET] [--client-id CLIENT_ID] [--format FORMAT] [--log-file FILE] [--log-level CRITICAL|DEBUG|INFO|ERROR|WARNING] [-r RELATION ID] [settings_name] [unit_name] No JUJU_AGENT_SOCKET/-s option found I tried juju debug-hooks tracks/0 -e local, that dropped me into a shell and relation-get still failed.

    Read the article

  • Relation between developers and clients

    - by guiman
    Hi everyone, i've been facing a situation at work and i would like to share it with you and tell me: Did you had to do it to? Should a developer be in direct contact wit the client? Or there should be an "adapter" guy that translates client needs in pseudo formal requirements understandable to us? I'm currently working in a small company that its taking care of implementing lots of systems, most of them for goverment institutions, in witch it generally means taking software developted 20 years ago and refurbish them so fit up-to-date needs. The clients generally are very used to them and tend to discourage change (they are in their 50s 60s give or take, so not technologie-friendly in general). As you can imagine, dev-team in most cases starts taking care of relation with clients, generating the documentation needed in this cases (CU usually), assisting to weekly meets to see improvements with clients. As for experience, this is a gold mine for me, because gives a nice perspective on all the aspects of software development, but also some problems rise because, if developers come from mars then client are from venus. So there is a fine gap on the vocabulary/experience/capability-to-interpret-needs that generates an noice in the communication, and some times affecting the final product.

    Read the article

  • Améliorer la pertinence des réponses aux demandes clients et réduire les DMT*

    - by Valérie De Montvallon
    Le Knowledge Management pour améliorer la pertinence des réponses aux demandes clients et réduire les DMT Avec le témoignage de SFR Lundi 2 juillet de 8h30 à 10h30 à l’Automobile Club de France, Paris Web, appel vocal, rendez-vous en agence, vos clients s'attendent aujourd’hui à obtenir une réponse unique, pertinente et rapide, quel que soit le canal de contact. Vos conseillers clients et vos agents ont besoin d'avoir accès facilement à l'information nécessaire. La volumétrie des données utilisées par les services de relation clients (centres de contacts, vendeurs en magasin, community manager…) est impressionnante, mixant souvent plusieurs sources d’information et nécessitant des recherches sémantiques. Rendez-vous le 2 juillet pour découvrir comment un outil de Knowledge Management permet d’optimiser la pertinence des résultats de recherche. Au cours de cette matinée d’échanges, Jocelyn Aubry, DSI Relation Client Grand Public chez SFR, partagera son expérience d'intégration de la solution Oracle InQuira pour constituer une base de connaissance unique et cross-canal, au service de ses conseillers clients. Inscription : [email protected]

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >